This repository was archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Addon adds actionHandler function to every function prop #63
Copy link
Copy link
Open
Description
Hey, let's say I have the following component:
const Box = ({ onEditClick }) => (
<div className="Box">
This is a Box
{onEditClick && <button onClick={onEditClick}>Edit</button>}
</div>
)
Box.propTypes = {
onEditClick: PropTypes.func,
}
Box.defaultProps = {
onEditClick: null,
}
and my Box.stories.js
import React from 'react'
import { storiesOf } from '@storybook/react'
import '../../../postcss-generated.css'
import './Box.stories.css'
import Box from 'components/atoms/Box/index'
import { withKnobs } from '@storybook/addon-knobs'
import { withSmartKnobs } from 'storybook-addon-smart-knobs'
const stories = storiesOf('Box', module).addParameters({
component: Box,
})
stories.addDecorator(withSmartKnobs).addDecorator(withKnobs)
stories.add('Playground', () => <Box />)
This works great, I can see the component but it always display the edit button even if I'm not passing anything in onEditClick prop.
When inspecting it I can see that there is a nactionHandler function automatically passed (and can't see there when I stop using storybook-addon-smart-knobs.
I would like to have the possibility of showing every combination of props, including a version without the edit button. Is there anything that I can do? Is there any configuration/option that I'm missing?
Love the addon, thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels