From 87b50c1fbdb6a463c2eba9e8142d2dadd9801a64 Mon Sep 17 00:00:00 2001 From: Ilya Artamonov Date: Wed, 14 Dec 2022 22:25:19 +0300 Subject: [PATCH] chore: Eslint fixes --- docs/.vitepress/config.ts | 2 +- .../rating/examples/RatingCountExample.vue | 9 ++-- .../rating/examples/RatingExample.vue | 2 +- .../examples/RatingStarSizesExample.vue | 6 +-- .../rating/examples/RatingWithTextExample.vue | 2 +- docs/components/rating/rating.md | 21 ++++---- src/components/Rating/Rating.vue | 49 ++++++++++++------- .../Rating/composables/useRatingClasses.ts | 11 ++--- 8 files changed, 54 insertions(+), 48 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index f6777ba..e744864 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -45,6 +45,7 @@ function getComponents() { { text: 'Carousel', link: 'components/carousel/carousel.md' }, { text: 'Dropdown', link: '/components/dropdown/dropdown.md' }, { text: 'Progress', link: 'components/progress/progress.md' }, + { text: 'Rating', link: 'components/rating/rating.md' }, { text: 'Spinner', link: '/components/spinner/spinner.md' }, { text: 'Tabs', link: '/components/tabs/tabs.md' }, { text: 'ListGroup', link: 'components/listGroup/listGroup.md' }, @@ -55,7 +56,6 @@ function getComponents() { { text: '- Footer', link: 'components/footer/footer.md' }, { text: '- Pagination', link: 'components/pagination/pagination.md' }, - { text: '- Rating', link: 'components/rating/rating.md' }, { text: '- Sidebar', link: 'components/sidebar/sidebar.md' }, { text: '- Table', link: 'components/table/table.md' }, { text: '- Timeline', link: 'components/timeline/timeline.md' }, diff --git a/docs/components/rating/examples/RatingCountExample.vue b/docs/components/rating/examples/RatingCountExample.vue index 91d051e..08cc1b9 100644 --- a/docs/components/rating/examples/RatingCountExample.vue +++ b/docs/components/rating/examples/RatingCountExample.vue @@ -1,15 +1,14 @@ diff --git a/docs/components/rating/examples/RatingExample.vue b/docs/components/rating/examples/RatingExample.vue index 7eab3d4..cb1626d 100644 --- a/docs/components/rating/examples/RatingExample.vue +++ b/docs/components/rating/examples/RatingExample.vue @@ -1,6 +1,6 @@ ``` @@ -26,7 +26,7 @@ If you also want to show a text near the stars you can use this example as a ref import { Rating } from 'flowbite-vue' @@ -36,7 +47,7 @@ import type { RatingSize } from './types' const props = defineProps({ size: { - type: String as PropType, // 'sm' | 'md' | 'lg' + type: String as PropType, default: 'sm', }, rating: { @@ -49,12 +60,12 @@ const props = defineProps({ }, reviewText: { type: String, - default: "" + default: '', }, reviewLink: { type: String, - default: "" - } + default: '', + }, }) const valid_star_number = computed(() => { diff --git a/src/components/Rating/composables/useRatingClasses.ts b/src/components/Rating/composables/useRatingClasses.ts index c90bd28..c25c8f4 100644 --- a/src/components/Rating/composables/useRatingClasses.ts +++ b/src/components/Rating/composables/useRatingClasses.ts @@ -6,7 +6,7 @@ import type { RatingSize } from '../types' const ratingSizeClasses: Record = { sm: 'w-5 h-5', md: 'w-7 h-7', - lg: 'w-10 h-10' + lg: 'w-10 h-10', } export type UseRatingClassesProps = { @@ -17,15 +17,12 @@ export function useRatingClasses(props: UseRatingClassesProps):{ sizeClasses: Ref }{ const sizeClasses = computed(() => { - let sizeClass = '' - sizeClass = ratingSizeClasses[props.size.value] return classNames( - sizeClass + ratingSizeClasses[props.size.value] ?? '', ) }) - return { - sizeClasses + sizeClasses, } -} \ No newline at end of file +}