|
| 1 | +--- |
| 2 | +import Layout from '@static/Layout.astro' |
| 3 | +import ComponentWrapper from '@static/ComponentWrapper.astro' |
| 4 | +
|
| 5 | +import AstroSwitch from '@components/Switch/Switch.astro' |
| 6 | +import SvelteSwitch from '@components/Switch/Switch.svelte' |
| 7 | +import ReactSwitch from '@components/Switch/Switch.tsx' |
| 8 | +
|
| 9 | +const sections = [ |
| 10 | + { |
| 11 | + title: 'Astro ratings', |
| 12 | + component: AstroSwitch |
| 13 | + }, |
| 14 | + { |
| 15 | + title: 'Svelte ratings', |
| 16 | + component: SvelteSwitch |
| 17 | + }, |
| 18 | + { |
| 19 | + title: 'React ratings', |
| 20 | + component: ReactSwitch |
| 21 | + } |
| 22 | +] |
| 23 | +--- |
| 24 | + |
| 25 | +<Layout> |
| 26 | + <h1>Switch</h1> |
| 27 | + <div class="grid md-2 lg-3"> |
| 28 | + <ComponentWrapper type="Astro"> |
| 29 | + <AstroSwitch /> |
| 30 | + </ComponentWrapper> |
| 31 | + |
| 32 | + <ComponentWrapper type="Svelte"> |
| 33 | + <SvelteSwitch color="#ee5253" /> |
| 34 | + </ComponentWrapper> |
| 35 | + |
| 36 | + <ComponentWrapper type="React"> |
| 37 | + <ReactSwitch color="#48dbfb" /> |
| 38 | + </ComponentWrapper> |
| 39 | + </div> |
| 40 | + |
| 41 | + {sections.map(section => ( |
| 42 | + <h1>{section.title}</h1> |
| 43 | + <div class="grid md-2 lg-3"> |
| 44 | + <ComponentWrapper title="Default"> |
| 45 | + <section.component /> |
| 46 | + </ComponentWrapper> |
| 47 | + |
| 48 | + <ComponentWrapper title="Toggled by default"> |
| 49 | + <section.component toggled={true} /> |
| 50 | + </ComponentWrapper> |
| 51 | + |
| 52 | + <ComponentWrapper title="With custom colors"> |
| 53 | + <section.component |
| 54 | + offColor="#ee5253" |
| 55 | + onColor="#1dd1a1" |
| 56 | + /> |
| 57 | + </ComponentWrapper> |
| 58 | + |
| 59 | + <ComponentWrapper title="With label"> |
| 60 | + <section.component label="Toggle me" /> |
| 61 | + </ComponentWrapper> |
| 62 | + |
| 63 | + <ComponentWrapper title="With label on left"> |
| 64 | + <section.component label="Toggle me" reverse={true} /> |
| 65 | + </ComponentWrapper> |
| 66 | + |
| 67 | + <ComponentWrapper title="Square toggle"> |
| 68 | + <section.component |
| 69 | + square={true} |
| 70 | + /> |
| 71 | + </ComponentWrapper> |
| 72 | + |
| 73 | + <ComponentWrapper title="Small toggle"> |
| 74 | + <section.component |
| 75 | + small={true} |
| 76 | + label="With label" |
| 77 | + /> |
| 78 | + </ComponentWrapper> |
| 79 | + |
| 80 | + <ComponentWrapper title="Small square toggle"> |
| 81 | + <section.component |
| 82 | + square={true} |
| 83 | + small={true} |
| 84 | + /> |
| 85 | + </ComponentWrapper> |
| 86 | + |
| 87 | + <ComponentWrapper title="Disabled toggle"> |
| 88 | + <section.component |
| 89 | + disabled={true} |
| 90 | + /> |
| 91 | + </ComponentWrapper> |
| 92 | + </div> |
| 93 | + ))} |
| 94 | +</Layout> |
0 commit comments