|
| 1 | +--- |
| 2 | +import ComponentWrapper from '@static/ComponentWrapper.astro' |
| 3 | +import Layout from '@static/Layout.astro' |
| 4 | +
|
| 5 | +import AstroKbd from '@components/Kbd/Kbd.astro' |
| 6 | +import SvelteKbd from '@components/Kbd/Kbd.svelte' |
| 7 | +import ReactKbd from '@components/Kbd/Kbd.tsx' |
| 8 | +import { keyMap } from '@components/Kbd/keyMap' |
| 9 | +
|
| 10 | +import { getSections } from '@helpers' |
| 11 | +
|
| 12 | +const sections = getSections({ |
| 13 | + title: 'kbds', |
| 14 | + components: [AstroKbd, SvelteKbd, ReactKbd] |
| 15 | +}) |
| 16 | +--- |
| 17 | + |
| 18 | +<Layout> |
| 19 | + <h1>Kbd</h1> |
| 20 | + <div class="grid md-2 lg-3"> |
| 21 | + <ComponentWrapper type="Astro"> |
| 22 | + <AstroKbd keys={['cmd', 'shift']}>A</AstroKbd> |
| 23 | + </ComponentWrapper> |
| 24 | + |
| 25 | + <ComponentWrapper type="Svelte"> |
| 26 | + <SvelteKbd keys={['ctrl', 'space']}>S</SvelteKbd> |
| 27 | + </ComponentWrapper> |
| 28 | + |
| 29 | + <ComponentWrapper type="React"> |
| 30 | + <ReactKbd keys={['up', 'down']}>R</ReactKbd> |
| 31 | + </ComponentWrapper> |
| 32 | + </div> |
| 33 | + |
| 34 | + {sections.map(section => ( |
| 35 | + <h1>{section.title}</h1> |
| 36 | + <Fragment> |
| 37 | + {section.subTitle && <h2 set:html={section.subTitle} />} |
| 38 | + </Fragment> |
| 39 | + <div class="grid md-2 lg-3"> |
| 40 | + <ComponentWrapper title="No key"> |
| 41 | + <section.component>N</section.component> |
| 42 | + <section.component keys={['capslock']} /> |
| 43 | + </ComponentWrapper> |
| 44 | + |
| 45 | + <ComponentWrapper title="One key"> |
| 46 | + <section.component keys={['cmd']}>O</section.component> |
| 47 | + </ComponentWrapper> |
| 48 | + |
| 49 | + <ComponentWrapper title="All keys"s> |
| 50 | + <section.component keys={Object.keys(keyMap)}>All</section.component> |
| 51 | + </ComponentWrapper> |
| 52 | + </div> |
| 53 | + ))} |
| 54 | +</Layout> |
0 commit comments