|
| 1 | +--- |
| 2 | +import Layout from '@static/Layout.astro' |
| 3 | +import ComponentWrapper from '@static/ComponentWrapper.astro' |
| 4 | +
|
| 5 | +import AstroRating from '@components/Rating/Rating.astro' |
| 6 | +import SvelteRating from '@components/Rating/Rating.svelte' |
| 7 | +import ReactRating from '@components/Rating/Rating.tsx' |
| 8 | +
|
| 9 | +const sections = [ |
| 10 | + { |
| 11 | + title: 'Astro ratings', |
| 12 | + component: AstroRating |
| 13 | + }, |
| 14 | + { |
| 15 | + title: 'Svelte ratings', |
| 16 | + component: SvelteRating |
| 17 | + }, |
| 18 | + { |
| 19 | + title: 'React ratings', |
| 20 | + component: ReactRating |
| 21 | + } |
| 22 | +] |
| 23 | +--- |
| 24 | + |
| 25 | +<Layout> |
| 26 | + <h1>Rating</h1> |
| 27 | + <div class="grid md-2 lg-3"> |
| 28 | + <AstroRating score={5} /> |
| 29 | + <SvelteRating score={4} color="#ee5253" /> |
| 30 | + <ReactRating score={3} color="#48dbfb" /> |
| 31 | + </div> |
| 32 | + |
| 33 | + {sections.map(section => ( |
| 34 | + <h1>{section.title}</h1> |
| 35 | + <div class="grid md-2 lg-3"> |
| 36 | + <ComponentWrapper title="Default 5-star rating"> |
| 37 | + <section.component score={5} /> |
| 38 | + </ComponentWrapper> |
| 39 | + |
| 40 | + <ComponentWrapper title="3-star rating"> |
| 41 | + <section.component score={3} /> |
| 42 | + </ComponentWrapper> |
| 43 | + |
| 44 | + <ComponentWrapper title="5-star rating out of 10"> |
| 45 | + <section.component score={5} total={10} /> |
| 46 | + </ComponentWrapper> |
| 47 | + |
| 48 | + <ComponentWrapper title="Rating without outline"> |
| 49 | + <section.component score={3} outline={false} /> |
| 50 | + </ComponentWrapper> |
| 51 | + |
| 52 | + <ComponentWrapper title="Rating without empty stars"> |
| 53 | + <section.component score={3} showEmpty={false} /> |
| 54 | + </ComponentWrapper> |
| 55 | + |
| 56 | + <ComponentWrapper title="Rating with size"> |
| 57 | + <section.component score={4} size={24} /> |
| 58 | + </ComponentWrapper> |
| 59 | + |
| 60 | + <ComponentWrapper title="Rating with color"> |
| 61 | + <section.component |
| 62 | + score={3} |
| 63 | + outline={false} |
| 64 | + color="#f7aa61" |
| 65 | + /> |
| 66 | + </ComponentWrapper> |
| 67 | + |
| 68 | + <ComponentWrapper title="Rating with empty color"> |
| 69 | + <section.component |
| 70 | + score={3} |
| 71 | + outline={false} |
| 72 | + color="#f7aa61" |
| 73 | + emptyColor='#555' |
| 74 | + /> |
| 75 | + </ComponentWrapper> |
| 76 | + |
| 77 | + <ComponentWrapper title="Rating with color and outline"> |
| 78 | + <section.component score={3} color="#f7aa61" /> |
| 79 | + </ComponentWrapper> |
| 80 | + |
| 81 | + <ComponentWrapper title="Rating with default text"> |
| 82 | + <section.component score={3} showText={true} /> |
| 83 | + </ComponentWrapper> |
| 84 | + |
| 85 | + <ComponentWrapper title="Rating with translated text"> |
| 86 | + <section.component |
| 87 | + score={3} |
| 88 | + showText={true} |
| 89 | + text="{0} from {1}" |
| 90 | + /> |
| 91 | + </ComponentWrapper> |
| 92 | + |
| 93 | + <ComponentWrapper title="Rating with review text"> |
| 94 | + <section.component |
| 95 | + score={3} |
| 96 | + reviewCount={123} |
| 97 | + /> |
| 98 | + </ComponentWrapper> |
| 99 | + |
| 100 | + <ComponentWrapper title="Rating with translated review text"> |
| 101 | + <section.component |
| 102 | + score={3} |
| 103 | + reviewCount={123} |
| 104 | + reviewText="{0} ratings" |
| 105 | + /> |
| 106 | + </ComponentWrapper> |
| 107 | + |
| 108 | + <ComponentWrapper title="Review text with link"> |
| 109 | + <section.component |
| 110 | + score={3} |
| 111 | + reviewCount={123} |
| 112 | + reviewText="{0} ratings" |
| 113 | + reviewLink="/avatar" |
| 114 | + /> |
| 115 | + </ComponentWrapper> |
| 116 | + |
| 117 | + <ComponentWrapper title="Rating with all text"> |
| 118 | + <section.component |
| 119 | + score={3} |
| 120 | + showText={true} |
| 121 | + reviewCount={123} |
| 122 | + reviewLink="/avatar" |
| 123 | + reviewTarget="_blank" |
| 124 | + /> |
| 125 | + </ComponentWrapper> |
| 126 | + </div> |
| 127 | + ))} |
| 128 | +</Layout> |
0 commit comments