Skip to content

Commit

Permalink
🐛 Merge pull request #185 from it-at-m/beta
Browse files Browse the repository at this point in the history
🐛 resolving bug of wrong imports
  • Loading branch information
langehm authored Aug 13, 2024
2 parents 310c73e + c747361 commit 2815c2d
Show file tree
Hide file tree
Showing 9 changed files with 1,617 additions and 1,826 deletions.
3,390 changes: 1,577 additions & 1,813 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"npm-run-all2": "^6.1.1",
"prettier": "^3.0.3",
"rimraf": "^6.0.0",
"semantic-release": "^22.0.0",
"semantic-release": "^23.1.1",
"semantic-release-gitmoji": "^1.6.5",
"storybook": "^8.0.9",
"typescript": "~5.5.0",
Expand Down
20 changes: 15 additions & 5 deletions src/components/Comment/MucComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,27 @@ const showDate = computed(() => {
return !!slots["date"];
});
/**
* Computes class for given variant
*/
const commentClass = computed(() => {
return props.variant === "slider"
? "m-comment--slider"
: "m-comment--listing";
});
/**
* Computes rating with min and max limits
*/
const computedRating = computed(() =>
Math.min(Math.max(props.rating, 0), MAX_STARS)
);
/*
* Converts the dot used on decimal numbers and converts it to a comma.
*/
const ratingWithDecimalComma = computed(() => {
return props.rating.toLocaleString(LOCALES.valueOf(), {
return computedRating.value.toLocaleString(LOCALES.valueOf(), {
minimumFractionDigits: 1,
});
});
Expand All @@ -145,14 +155,14 @@ const ratingWithDecimalComma = computed(() => {
Calculates the amount of full, empty and half-stars to be displayed.
*/
const evaluateRating = computed(() => {
const decimalPart = +(props.rating % 1).toFixed(1); // ask Brendan Eich why "3.3 % 1 = 0.2999999999999998" and then come back
const decimalPart = +(computedRating.value % 1).toFixed(1); // ask Brendan Eich why "3.3 % 1 = 0.2999999999999998" and then come back
let fullStars = Math.min(Math.floor(props.rating), MAX_STARS);
let emptyStars = Math.floor(MAX_STARS - props.rating);
let fullStars = Math.min(Math.floor(computedRating.value), MAX_STARS);
let emptyStars = Math.floor(MAX_STARS - computedRating.value);
let isHalfStar = false;
// evaluating half-stars and if the rating is e.g. 3.9 an extra full star needs to be displayed
if (props.rating !== 0.0 && props.rating !== MAX_STARS) {
if (computedRating.value !== 0.0 && computedRating.value !== MAX_STARS) {
if (decimalPart <= LOWER_THRESHOLD) emptyStars++;
else if (decimalPart >= UPPER_THRESHOLD) fullStars++;
else isHalfStar = true;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/MucRadioButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MucRadioButtonGroup from "./MucRadioButtonGroup.vue";

export default {
component: MucRadioButton,
title: "Forms/RadioButton",
title: "Forms/MucRadioButton",
tags: ["autodocs"],
parameters: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/MucRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script setup lang="ts">
import { computed, inject } from "vue";
import { RadioButtonGroupKey } from "./RadioButtonTypes";
import { RadioButtonGroupKey } from "./MucRadioButtonTypes";
const props = withDefaults(
defineProps<{
Expand Down
5 changes: 4 additions & 1 deletion src/components/Form/MucRadioButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<script setup lang="ts">
import { provide, readonly, toRef } from "vue";
import { RadioButtonGroupKey, RadioButtonValueTypes } from "./RadioButtonTypes";
import {
RadioButtonGroupKey,
RadioButtonValueTypes,
} from "./MucRadioButtonTypes";
/**
* exposed two-way binding of the currently selected radiobuttons-value
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions src/components/Form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import MucForm from "./MucInput.vue";
import MucInput from "./MucInput.vue";
import MucRadioButton from "./MucRadioButton.vue";
import MucRadioButtonGroup from "./MucRadioButtonGroup.vue";
import MucSingleSelect from "./MucSelect.vue";
import MucSelect from "./MucSelect.vue";
import MucTextArea from "./MucTextArea.vue";

Expand All @@ -17,7 +16,6 @@ export {
MucInput,
MucRadioButton,
MucTextArea,
MucSingleSelect,
MucErrorList,
MucSelect,
};
20 changes: 18 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import { MucButton } from "./Button";
import { MucCallout } from "./Callout";
import { MucCard, MucCardContainer } from "./Card";
import { MucComment, MucCommentText } from "./Comment/";
import { MucForm } from "./Form";
import {
MucCheckbox,
MucCheckboxGroup,
MucErrorList,
MucInput,
MucRadioButton,
MucRadioButtonGroup,
MucSelect,
MucTextArea,
} from "./Form";
import { MucIcon } from "./Icon";
import { MucIntro } from "./Intro";

Expand All @@ -16,6 +25,13 @@ export {
MucCardContainer,
MucComment,
MucCommentText,
MucForm,
MucRadioButton,
MucRadioButtonGroup,
MucInput,
MucTextArea,
MucCheckboxGroup,
MucCheckbox,
MucSelect,
MucErrorList,
MucIcon,
};

0 comments on commit 2815c2d

Please sign in to comment.