|
| 1 | +import type { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import { PhysicalLayout } from './PhysicalLayout'; |
| 3 | + |
| 4 | +// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export |
| 5 | +const meta = { |
| 6 | + title: 'Keyboard/PhysicalLayout', |
| 7 | + component: PhysicalLayout, |
| 8 | + parameters: { |
| 9 | + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout |
| 10 | + }, |
| 11 | + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs |
| 12 | + tags: ['autodocs'], |
| 13 | + // More on argTypes: https://storybook.js.org/docs/api/argtypes |
| 14 | + argTypes: { |
| 15 | + }, |
| 16 | + args: { }, |
| 17 | +} satisfies Meta<typeof PhysicalLayout>; |
| 18 | + |
| 19 | +export default meta; |
| 20 | +type Story = StoryObj<typeof meta>; |
| 21 | + |
| 22 | +const TOP = ["Esc", ..."QWERTYUIOP"]; |
| 23 | +const MIDDLE = [..."ASDFGHJKL;"]; |
| 24 | +const LOWER = [..."ZXCVBNM<>", "Up", "Shift"]; |
| 25 | + |
| 26 | +// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args |
| 27 | +export const Minivan: Story = { |
| 28 | + args: { |
| 29 | + positions: [ |
| 30 | + ...TOP.map((k,i) => ({ |
| 31 | + width: 1, |
| 32 | + height: 1, |
| 33 | + x: i, |
| 34 | + y: 0, |
| 35 | + header: "Key Press", |
| 36 | + children: [<span>{k}</span>] |
| 37 | + })) |
| 38 | + , { x: TOP.length, y: 0, width: 1.75, height: 1, header: "Key Press", children: [<span>Backspace</span>]} |
| 39 | + , { x: 0, y: 1, width: 1.25, height: 1, header: "Key Press", children: [<span>Tab</span>]} |
| 40 | + , ...MIDDLE.map((k,i) => ({ x: i+1.25, y: 1, width: 1, height: 1, header: "Key Press", children: [<span>{k}</span>]})) |
| 41 | + , { x: MIDDLE.length + 1.25, y: 1, width: 1.5, height: 1, header: "Key Press", children: [<span>Enter</span>]} |
| 42 | + , { x: 0, y: 2, width: 1.75, height: 1, header: "Key Press", children: [<span>Shift</span>]} |
| 43 | + , ...LOWER.map((k,i) => ({ x: i+1.75, y: 2, width: 1, height: 1, header: "Key Press", children: [<span>{k}</span>]})) |
| 44 | + , { x: 0, y: 3, width: 1.25, height: 1, header: "Key Press", children: [<span>Control</span>]} |
| 45 | + , { x: 1.25, y: 3, width: 1.5, height: 1, header: "Key Press", children: [<span>Code</span>]} |
| 46 | + , { x: 2.75, y: 3, width: 1.25, height: 1, header: "Key Press", children: [<span>Alt</span>]} |
| 47 | + , { x: 4, y: 3, width: 2.25, height: 1, header: "Key Press", children: [<span></span>]} |
| 48 | + , { x: 6.25, y: 3, width: 2, height: 1, header: "Key Press", children: [<span></span>]} |
| 49 | + , { x: 8.25, y: 3, width: 1.5, height: 1, header: "Key Press", children: [<span>Alt</span>]} |
| 50 | + , { x: 9.75, y: 3, width: 1, height: 1, header: "Key Press", children: [<span>Left</span>]} |
| 51 | + , { x: 10.75, y: 3, width: 1, height: 1, header: "Key Press", children: [<span>Down</span>]} |
| 52 | + , { x: 11.75, y: 3, width: 1, height: 1, header: "Key Press", children: [<span>Right</span>]} |
| 53 | + ] |
| 54 | + }, |
| 55 | +}; |
0 commit comments