Skip to content

Commit

Permalink
docs: allow controls on storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
KnowsCount committed Mar 16, 2022
1 parent ba21155 commit fed1c69
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
expanded: true,
matchers: {
color: /(background|color)$/i,
date: /Date$/,
Expand Down
25 changes: 22 additions & 3 deletions src/heatmap/Heatmap.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,30 @@ import { getRandomCount } from '../utils'
export default {
title: 'Example/Heatmap',
component: Heatmap,
parameters: {
controls: {
sort: 'requiredFirst',
},
layout: 'centered',
},
argTypes: {
squareNumber: {
control: { type: 'range', min: 0, max: 365, step: 1 },
},
},
}

export const Default = () => (
<Heatmap squareNumber={DAYS_IN_YEAR} count={getRandomCount(DAYS_IN_YEAR)} />
)
const Template = (args) => {
return <Heatmap {...args} />
}

export const Default = Template.bind({})
Default.args = {
args: {
squareNumber: DAYS_IN_YEAR,
count: getRandomCount(DAYS_IN_YEAR),
},
}

export const OtherColour = () => (
<Heatmap
Expand Down

1 comment on commit fed1c69

@vercel
Copy link

@vercel vercel bot commented on fed1c69 Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.