import React, { useState } from 'react'; import { action } from '@storybook/addon-actions'; import { Button } from '../src'; import { primaryColor } from '../src/config'; import { SketchPicker } from 'react-color'; import { withKnobs, text } from "@storybook/addon-knobs"; export default { title: 'Button', component: Button, decorators: [withKnobs] }; export const All = () => { const [ color, setColor ] = useState(primaryColor); const [ txtColor, setTxtColor ] = useState("white"); const getColor = (r : number, g : number, b : number) => `rgb(${r},${g}, ${b})`; const getInvertColor = (r : number, g : number, b : number) => `rgb(${255 - r},${255 - g}, ${255 - b})`; const handleColorChange = ( color : any)=>{ const { r, g, b } = color.rgb; setColor(getColor(r,g,b)); setTxtColor(r + g + b > 630? "black" : "white"); } const props = { onClick: action('clicked'), primaryColor: color, color: txtColor } return(
) }; export const PrimaryButton = () => ; export const ShadowButton = () => ; export const DisabledButton = () => ; export const RoundButton = () => ; export const InvertedButton = () => ; export const CustomButton = () => ; export const LoadingButton = () => ;