/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* A button is anything that once clicked performs an instant action.
*
* @see https://github.com/brave/brave-ui/blob/master/docs/spec.md#buttons
*
* In this file:
* ---
* UnstyledButton
* PushButton
* SwitchButton
* ContentToggleArrow
*/
// Storybook requires
import { storiesOf, addDecorator } from '@storybook/react'
import { withKnobs, text, boolean, select } from '@storybook/addon-knobs'
import { action } from '@storybook/addon-actions'
import { withState } from '@dump247/storybook-state'
import { BetterVisualizer } from './storyUtil'
// Components
import * as React from 'react'
import { PushButtonLink } from '../components/v1/pushButton'
import UnstyledButton from '../components/unstyledButton'
import SwitchButton from '../components/switchButton'
import ContentToggleArrow from '../components/contentToggleArrow'
addDecorator(withKnobs)
// Globally adapt the story visualizer for this story
addDecorator(BetterVisualizer)
storiesOf('Buttons', module)
.add('UnstyledButton', () => {
return (
)
})
.add('PushButton', () => {
const label = 'Button Types'
const options = {
default: 'Default',
primary: 'Primary',
secondary: 'Secondary'
}
const defaultValue = 'default'
const value = select(label, options, defaultValue)
return (
{text('Label', 'Hello Button')}
)
})
.add('SwitchButton', withState({ checked: false }, (store) => {
const label = 'Button Sizes'
const options = {
default: 'Default',
large: 'Large',
small: 'Small'
}
const defaultValue = 'medium'
const value = select(label, options, defaultValue)
return (
(
store.set({ checked: !store.state.checked })
)}
/>
)
}))
.add('ContentToggleArrow', withState({ open: true }, (store) => {
return (
(
store.set({ open: !store.state.open })
)}>
Some text inside!
)
}))