Skip to content

Commit

Permalink
feat(voronoi): move stories to the dedicated storybook workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Apr 29, 2023
1 parent 8be3c80 commit f4030a8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
57 changes: 30 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@nivo/swarmplot": "workspace:*",
"@nivo/tooltip": "workspace:*",
"@nivo/treemap": "workspace:*",
"@nivo/voronoi": "workspace:*",
"@nivo/waffle": "workspace:*",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import type { Meta, StoryObj } from '@storybook/react'
import { useState, useEffect } from 'react'
import { storiesOf } from '@storybook/react'
import { line, curveLinearClosed } from 'd3-shape'
import { Voronoi, VoronoiCustomLayerProps } from '../src'
import { Voronoi, VoronoiCustomLayerProps } from '@nivo/voronoi'

const stories = storiesOf('Voronoi', module)
const meta: Meta<typeof Voronoi> = {
title: 'Voronoi',
component: Voronoi,
tags: ['autodocs'],
}

export default meta
type Story = StoryObj<typeof Voronoi>

const lineGenerator = line<[number, number]>().curve(curveLinearClosed)

Expand Down Expand Up @@ -150,7 +157,7 @@ const Layer = ({ points, voronoi }: VoronoiCustomLayerProps) => {

const randColor = () => '#' + (0x1000000 + Math.random() * 0xffffff).toString(16).substr(1, 6)

const Nekoronoi = () => {
const NekoronoiComponent = () => {
const [data, setData] = useState([
{
id: 'cat_00',
Expand Down Expand Up @@ -235,4 +242,6 @@ const Nekoronoi = () => {
)
}

stories.add('nekoronoi', () => <Nekoronoi />)
export const Nekoronoi: Story = {
render: () => <NekoronoiComponent />,
}

0 comments on commit f4030a8

Please sign in to comment.