diff --git a/src/lib/components/rating/Rating.svelte b/src/lib/components/rating/Rating.svelte index 39cd91eb..03e288c1 100644 --- a/src/lib/components/rating/Rating.svelte +++ b/src/lib/components/rating/Rating.svelte @@ -8,18 +8,17 @@ export let size: 'sm' | 'md' | 'lg' = 'md'; export let showValue = false; - let defaultClass = 'rating text-primary'; - - defaultClass = twMerge(defaultClass, $$props.class); - function handleSelect(rating: number) { value = rating; } + + const defaultClass = 'rating text-primary'; + $: finalClass = twMerge(defaultClass, $$props.class);
import { Card, Col, Rating } from '../../lib'; + import { example, halfExample, sizeExample, showValueExample, props } from './examples'; + import { PropsTable, SlotsTable, CodeBlock } from '../../docs'; @@ -9,6 +11,10 @@
+ +
+ + @@ -20,6 +26,10 @@
+ +
+ + @@ -33,6 +43,10 @@
+ +
+ + @@ -52,6 +66,14 @@
+ +
+ + + + + + diff --git a/src/routes/rating/examples.ts b/src/routes/rating/examples.ts new file mode 100644 index 00000000..8f11e45f --- /dev/null +++ b/src/routes/rating/examples.ts @@ -0,0 +1,86 @@ +import type { Prop } from '../../docs'; + +export const props: Prop[] = [ + { + id: '1', + prop: 'half', + type: 'boolean', + default: 'false' + }, + { + id: '2', + prop: 'outOf', + type: 'number', + default: '5' + }, + { + id: '3', + prop: 'name', + type: 'string', + default: '' + }, + { + id: '4', + prop: 'value', + type: 'number', + default: '0' + }, + { + id: '5', + prop: 'size', + type: "'sm' | 'md' | 'lg'", + default: 'md' + }, + { + id: '6', + prop: 'showValue', + type: 'boolean', + default: 'false' + } +]; + +export const example = ` + + + +
+`; + +export const halfExample = ` + + + +
+`; + +export const sizeExample = ` + + + +
+ +
+`; + +export const showValueExample = ` + + + +
+ +
+ +
+ +
+ +
+`;