Skip to content

Commit

Permalink
Upgrade Storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Jul 25, 2023
1 parent 43e790d commit cd8d292
Show file tree
Hide file tree
Showing 3 changed files with 1,306 additions and 1,896 deletions.
14 changes: 7 additions & 7 deletions apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
"three": "0.141.0"
},
"devDependencies": {
"@storybook/addon-docs": "7.0.5",
"@storybook/addon-essentials": "7.0.5",
"@storybook/addon-links": "7.0.5",
"@storybook/addon-mdx-gfm": "7.0.5",
"@storybook/react": "7.0.5",
"@storybook/react-vite": "7.0.5",
"@storybook/addon-docs": "7.1.1",
"@storybook/addon-essentials": "7.1.1",
"@storybook/addon-links": "7.1.1",
"@storybook/addon-mdx-gfm": "7.1.1",
"@storybook/react": "7.1.1",
"@storybook/react-vite": "7.1.1",
"@types/d3-format": "~3.0.1",
"@types/lodash": "~4.14.195",
"@types/ndarray": "1.0.11",
Expand All @@ -54,7 +54,7 @@
"eslint": "8.28.0",
"eslint-config-galex": "4.5.2",
"remark-gfm": "3.0.1",
"storybook": "7.0.5",
"storybook": "7.1.1",
"typescript": "5.0.4",
"vite": "4.3.9"
},
Expand Down
53 changes: 25 additions & 28 deletions apps/storybook/src/Annotation.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,26 @@ import { formatCoord } from './utils';
const meta = {
title: 'Building Blocks/Annotation',
parameters: { layout: 'fullscreen' },
decorators: [FillHeight],
decorators: [
(Story) => (
<VisCanvas
abscissaConfig={{ visDomain: [0, 41], showGrid: true }}
ordinateConfig={{ visDomain: [0, 20], showGrid: true }}
>
<DefaultInteractions />
<Story />
</VisCanvas>
),
FillHeight,
],
} satisfies Meta;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default = {
render: () => (
<VisCanvas
abscissaConfig={{ visDomain: [0, 41], showGrid: true }}
ordinateConfig={{ visDomain: [0, 20], showGrid: true }}
>
<DefaultInteractions />
<>
<Annotation x={10} y={16}>
HTML annotation positioned at (10, 16)
</Annotation>
Expand Down Expand Up @@ -87,17 +94,13 @@ export const Default = {
</svg>
</>
</Annotation>
</VisCanvas>
</>
),
} satisfies Story;

export const WithZoom = {
render: () => (
<VisCanvas
abscissaConfig={{ visDomain: [0, 41], showGrid: true }}
ordinateConfig={{ visDomain: [0, 20], showGrid: true }}
>
<DefaultInteractions />
<>
<Annotation x={10} y={16} scaleOnZoom style={{ width: 230 }}>
HTML annotation at (10, 16) that scales with zoom.
</Annotation>
Expand All @@ -111,7 +114,7 @@ export const WithZoom = {
Another annotation that scales with zoom but this time{' '}
<strong>centred</strong> on (25, 10)
</Annotation>
</VisCanvas>
</>
),
} satisfies Story;

Expand All @@ -137,20 +140,14 @@ function PointerTracker(props: {

export const FollowPointer = {
render: () => (
<VisCanvas
abscissaConfig={{ visDomain: [0, 41], showGrid: true }}
ordinateConfig={{ visDomain: [0, 20], showGrid: true }}
>
<DefaultInteractions />
<PointerTracker>
{(x, y) => (
<Annotation
x={x + 0.5} // slight offset from pointer
y={y - 0.5}
style={{ whiteSpace: 'nowrap' }}
>{`x=${formatCoord(x)}, y=${formatCoord(y)}`}</Annotation>
)}
</PointerTracker>
</VisCanvas>
<PointerTracker>
{(x, y) => (
<Annotation
x={x + 0.5} // slight offset from pointer
y={y - 0.5}
style={{ whiteSpace: 'nowrap' }}
>{`x=${formatCoord(x)}, y=${formatCoord(y)}`}</Annotation>
)}
</PointerTracker>
),
} satisfies Story;
Loading

0 comments on commit cd8d292

Please sign in to comment.