-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45d9c55
commit 8535624
Showing
13 changed files
with
555 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import React, { FunctionComponent, Validator } from 'react'; | ||
|
||
import { Form } from '@storybook/components'; | ||
|
||
const ButtonType = ({ knob, onClick }) => ( | ||
interface ButtonTypeKnobProp { | ||
name: string; | ||
} | ||
|
||
interface ButtonTypeProps { | ||
knob: ButtonTypeKnobProp; | ||
onClick: (knob: ButtonTypeKnobProp) => any; | ||
} | ||
|
||
const serialize = (): undefined => undefined; | ||
const deserialize = (): undefined => undefined; | ||
|
||
const ButtonType: FunctionComponent<ButtonTypeProps> & { | ||
serialize: typeof serialize; | ||
deserialize: typeof deserialize; | ||
} = ({ knob, onClick }) => ( | ||
<Form.Button type="button" name={knob.name} onClick={() => onClick(knob)}> | ||
{knob.name} | ||
</Form.Button> | ||
); | ||
|
||
ButtonType.defaultProps = { | ||
knob: {} as any, | ||
}; | ||
|
||
ButtonType.propTypes = { | ||
// TODO: remove `any` once DefinitelyTyped/DefinitelyTyped#31280 has been resolved | ||
knob: PropTypes.shape({ | ||
name: PropTypes.string, | ||
}).isRequired, | ||
}).isRequired as Validator<any>, | ||
onClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
ButtonType.serialize = () => undefined; | ||
ButtonType.deserialize = () => undefined; | ||
ButtonType.serialize = serialize; | ||
ButtonType.deserialize = deserialize; | ||
|
||
export default ButtonType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.