Skip to content

Instantly share code, notes, and snippets.

@rafaelrozon
Created September 11, 2020 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrozon/911f75360bd56ae9f4a7eff4cebc5f61 to your computer and use it in GitHub Desktop.
Save rafaelrozon/911f75360bd56ae9f4a7eff4cebc5f61 to your computer and use it in GitHub Desktop.
import React from "react";
import {storiesOf} from "@storybook/react";
import { withKnobs, text } from '@storybook/addon-knobs';
import Button from ".";
const storiesOf("Button", module).
addDecorator(withKnobs)
add("Default", () => {
return <Button type="button" text="Click me" />
}).
add("Playground", () => {
const typePropLabel = 'type';
const typePropOptions = {
submit: 'submit',
input: 'input'
};
const typePropDefaultValue = typePropOptions.submit;
const textPropLabel = "text";
const textDefaultValue = "Click me";
return (
<Button type={select(typePropLabel, typePropOptions, typePropDefaultValue)} text={text(textPropLabel, textDefaultValue)} />
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment