diff --git a/addons/actions/package.json b/addons/actions/package.json index 6bfd462717fe..f521f44e0e87 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -20,7 +20,9 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { + "@storybook/components": "^3.4.0-alpha.8", "deep-equal": "^1.0.1", + "glamorous": "^4.11.6", "global": "^4.3.2", "make-error": "^1.3.4", "prop-types": "^15.6.0", diff --git a/addons/actions/src/components/ActionLogger/index.js b/addons/actions/src/components/ActionLogger/index.js index 80d6c6369d09..a22ec9e703a6 100644 --- a/addons/actions/src/components/ActionLogger/index.js +++ b/addons/actions/src/components/ActionLogger/index.js @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import Inspector from 'react-inspector'; -import style from './style'; +import { Actions, Action, Button, Wrapper, InspectorContainer, Countwrap, Counter } from './style'; class ActionLogger extends Component { getActionData() { @@ -9,30 +9,28 @@ class ActionLogger extends Component { } renderAction(action) { - const counter =
{action.count}
; + const counter = {action.count}; return ( -
-
{action.count > 1 && counter}
-
+ + {action.count > 1 && counter} + -
-
+ + ); } render() { return ( -
-
{this.getActionData()}
- -
+ + {this.getActionData()} + + ); } } diff --git a/addons/actions/src/components/ActionLogger/style.js b/addons/actions/src/components/ActionLogger/style.js index b7afc0524051..1784321bb827 100644 --- a/addons/actions/src/components/ActionLogger/style.js +++ b/addons/actions/src/components/ActionLogger/style.js @@ -1,49 +1,53 @@ -export default { - wrapper: { - flex: 1, - display: 'flex', - position: 'relative', - }, - actions: { - flex: 1, - margin: 0, - padding: '8px 2px 20px 0', - overflowY: 'auto', - color: '#666', - }, - action: { - display: 'flex', - padding: '3px 3px 3px 0', - borderLeft: '5px solid white', - borderBottom: '1px solid #fafafa', - transition: 'all 0.1s', - alignItems: 'start', - }, - countwrap: { - paddingBottom: 2, - }, - counter: { - margin: '0 5px 0 5px', - backgroundColor: '#777777', - color: '#ffffff', - padding: '1px 5px', - borderRadius: '20px', - }, - inspector: { - flex: 1, - padding: '0 0 0 5px', - }, - button: { - position: 'absolute', - bottom: 0, - right: 0, - border: 'none', - borderTop: 'solid 1px rgba(0, 0, 0, 0.2)', - borderLeft: 'solid 1px rgba(0, 0, 0, 0.2)', - background: 'rgba(255, 255, 255, 0.5)', - padding: '5px 10px', - borderRadius: '4px 0 0 0', - color: 'rgba(0, 0, 0, 0.5)', - outline: 'none', - }, -}; +import glamorous from 'glamorous'; +import { Button as BaseButton } from '@storybook/components'; + +export const Actions = glamorous.pre({ + flex: 1, + margin: 0, + padding: '8px 2px 20px 0', + overflowY: 'auto', + color: '#666', +}); + +export const Action = glamorous.div({ + display: 'flex', + padding: '3px 3px 3px 0', + borderLeft: '5px solid white', + borderBottom: '1px solid #fafafa', + transition: 'all 0.1s', + alignItems: 'start', +}); + +export const Button = glamorous(BaseButton)({ + position: 'absolute', + bottom: 0, + right: 0, + borderRadius: '4px 0 0 0', + textTransform: 'uppercase', + letterSpacing: 1, + paddingTop: 5, + paddingBootom: 5, +}); + +export const Counter = glamorous.div({ + margin: '0 5px 0 5px', + backgroundColor: '#777777', + color: '#ffffff', + padding: '1px 5px', + borderRadius: '20px', +}); + +export const Countwrap = glamorous.div({ + paddingBottom: 2, +}); + +export const InspectorContainer = glamorous.div({ + flex: 1, + padding: '0 0 0 5px', +}); + +export const Wrapper = glamorous.div({ + flex: 1, + display: 'flex', + position: 'relative', +}); diff --git a/lib/components/src/form/__snapshots__/button.stories.storyshot b/lib/components/src/form/__snapshots__/button.stories.storyshot new file mode 100644 index 000000000000..720d334db2f3 --- /dev/null +++ b/lib/components/src/form/__snapshots__/button.stories.storyshot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Storyshots Components|Form/Button with onclick 1`] = ` + +`; diff --git a/lib/components/src/form/button.js b/lib/components/src/form/button.js new file mode 100644 index 000000000000..a6d2d6945d80 --- /dev/null +++ b/lib/components/src/form/button.js @@ -0,0 +1,28 @@ +import glamorous from 'glamorous'; +import { baseFonts } from '../theme'; + +export default glamorous + .button({ + ...baseFonts, + border: 'none', + boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.2)', + backgroundColor: 'rgb(255, 255, 255)', + padding: '4px 10px 7px', + borderRadius: 4, + cursor: 'pointer', + transition: 'box-shadow 0.15s ease-out', + ':hover': { + transition: 'background-color 0.15s ease-out', + boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.3)', + }, + ':focus': { + transition: 'background-color 0.15s ease-out', + outline: 'none', + boxShadow: '0 0 0 2px rgba(0, 0, 0, 0.3)', + }, + ':active': { + transition: 'none', + backgroundColor: 'rgb(247, 247, 247)', + }, + }) + .withProps({ type: 'button' }); diff --git a/lib/components/src/form/button.stories.js b/lib/components/src/form/button.stories.js new file mode 100644 index 000000000000..caba82eab126 --- /dev/null +++ b/lib/components/src/form/button.stories.js @@ -0,0 +1,10 @@ +import React from 'react'; +import { storiesOf } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { withKnobs, text } from '@storybook/addon-knobs'; + +import Button from './button'; + +storiesOf('Components|Form/Button', module) + .addDecorator(withKnobs) + .add('with onclick', () => ); diff --git a/lib/components/src/index.js b/lib/components/src/index.js index 3f43cb8e9a0e..466e146ca59f 100644 --- a/lib/components/src/index.js +++ b/lib/components/src/index.js @@ -5,3 +5,5 @@ export { default as MenuLink } from './navigation/menu_link'; export { default as HighlightButton } from './highlight_button'; export { default as Table } from './table/table'; export { td as Td, th as Th } from './table/cell'; + +export { default as Button } from './form/button'; diff --git a/lib/components/src/navigation/__snapshots__/menu_link.stories.storyshot b/lib/components/src/navigation/__snapshots__/menu_link.stories.storyshot index 59c87d1a7f50..d7944c81664f 100644 --- a/lib/components/src/navigation/__snapshots__/menu_link.stories.storyshot +++ b/lib/components/src/navigation/__snapshots__/menu_link.stories.storyshot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots components/MenuLink active 1`] = ` +exports[`Storyshots Components|Navigation/MenuLink active 1`] = ` `; -exports[`Storyshots components/MenuLink default 1`] = ` +exports[`Storyshots Components|Navigation/MenuLink default 1`] = ` `; -exports[`Storyshots components/MenuLink with knobs 1`] = ` +exports[`Storyshots Components|Navigation/MenuLink with knobs 1`] = `
diff --git a/lib/components/src/navigation/__snapshots__/routed_link.stories.storyshot b/lib/components/src/navigation/__snapshots__/routed_link.stories.storyshot index ba94bf2744d4..414e03a58e0e 100644 --- a/lib/components/src/navigation/__snapshots__/routed_link.stories.storyshot +++ b/lib/components/src/navigation/__snapshots__/routed_link.stories.storyshot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots components/RoutedLink w/ href 1`] = ` +exports[`Storyshots Components|Navigation/RoutedLink w/ href 1`] = ` @@ -8,7 +8,7 @@ exports[`Storyshots components/RoutedLink w/ href 1`] = ` `; -exports[`Storyshots components/RoutedLink w/ onClick 1`] = ` +exports[`Storyshots Components|Navigation/RoutedLink w/ onClick 1`] = ` diff --git a/lib/components/src/navigation/menu_link.stories.js b/lib/components/src/navigation/menu_link.stories.js index 0f866e19b7d0..a63237dccaba 100644 --- a/lib/components/src/navigation/menu_link.stories.js +++ b/lib/components/src/navigation/menu_link.stories.js @@ -6,7 +6,7 @@ import { Div } from 'glamorous'; import MenuLink from './menu_link'; -storiesOf('components/MenuLink', module) +storiesOf('Components|Navigation/MenuLink', module) .add('default', () => Link) .add('active', () => ( diff --git a/lib/components/src/navigation/routed_link.stories.js b/lib/components/src/navigation/routed_link.stories.js index 0c372b88d410..c78d7b52c537 100644 --- a/lib/components/src/navigation/routed_link.stories.js +++ b/lib/components/src/navigation/routed_link.stories.js @@ -5,7 +5,7 @@ import { action } from '@storybook/addon-actions'; import RoutedLink from './routed_link'; const onClick = action('onClick'); -storiesOf('components/RoutedLink', module) +storiesOf('Components|Navigation/RoutedLink', module) .add('w/ onClick', () => ( Try clicking with different mouse buttons and modifier keys (shift/ctrl/alt/cmd) diff --git a/lib/ui/src/modules/ui/components/addon_panel/__snapshots__/index.stories.storyshot b/lib/ui/src/modules/ui/components/addon_panel/__snapshots__/index.stories.storyshot index 4cd7ec747a0d..ae823672c91f 100644 --- a/lib/ui/src/modules/ui/components/addon_panel/__snapshots__/index.stories.storyshot +++ b/lib/ui/src/modules/ui/components/addon_panel/__snapshots__/index.stories.storyshot @@ -5,7 +5,7 @@ exports[`Storyshots ui/AddonPanel default 1`] = ` style="height:100px;display:flex" >