Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Storybook #1459

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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