From 9348dc9ce133bdf10f649dd102ecf9b10be3ca13 Mon Sep 17 00:00:00 2001 From: Rob Levin Date: Fri, 18 Sep 2020 08:15:38 -0700 Subject: [PATCH] Refactors React buttons. --- .../src/__snapshots__/storybook.test.js.snap | 84 ++++++++----------- agnosticui-react/src/stories/Button.js | 25 +----- .../src/stories/Button.stories.js | 71 ++++++++-------- agnosticui-react/src/stories/Button.test.js | 4 +- .../src/stories/ButtonGroup.stories.js | 72 ++++++++-------- .../src/stories/ButtonIcon.stories.js | 6 +- 6 files changed, 113 insertions(+), 149 deletions(-) diff --git a/agnosticui-react/src/__snapshots__/storybook.test.js.snap b/agnosticui-react/src/__snapshots__/storybook.test.js.snap index 3a89be306..51274971f 100644 --- a/agnosticui-react/src/__snapshots__/storybook.test.js.snap +++ b/agnosticui-react/src/__snapshots__/storybook.test.js.snap @@ -6,19 +6,19 @@ Array [ className="btn my-custom-css-klass" type="button" > - Custom CSS Override + Go , , , ] `; @@ -29,43 +29,43 @@ Array [ className="btn" type="button" > - Default + Go , , , , , , , ] `; @@ -76,25 +76,25 @@ Array [ className="btn disabled" type="button" > - Default Disabled + Go , , , , ] `; @@ -384,7 +384,7 @@ exports[`Storyshots Button Icons Button Icons 1`] = ` Array [
,
, , , , , , , ] `; @@ -488,89 +488,77 @@ Array [ className="btn secondary" type="button" > - Secondary + Go , , , , , , , ] `; exports[`Storyshots Button Sizes 1`] = ` Array [ - , , , ] `; exports[`Storyshots Button Types 1`] = ` Array [ - , , , ] `; diff --git a/agnosticui-react/src/stories/Button.js b/agnosticui-react/src/stories/Button.js index 125edb98c..e7a24fc33 100644 --- a/agnosticui-react/src/stories/Button.js +++ b/agnosticui-react/src/stories/Button.js @@ -5,7 +5,6 @@ import styles from './button.module.css'; const Button = ({ children, mode, - label, size, isSkinned, isBordered, @@ -13,8 +12,6 @@ const Button = ({ isDisabled, isRaised, isBlock, - isIconLeft, - isIconRight, isBlank, css, type, @@ -32,8 +29,6 @@ const Button = ({ isDisabled ? styles.disabled : "", isRaised ? styles.raised : "", isBlock ? styles.block : "", - isIconLeft ? styles.iconLeft : "", - isIconRight ? styles.iconRight : "", isBlank ? styles.blank : "", css ? `${css}` : "", ]; @@ -42,26 +37,13 @@ const Button = ({ return ( ); }; Button.propTypes = { mode: PropTypes.oneOf(['primary', 'secondary']), - label: PropTypes.string, size: PropTypes.string, css: PropTypes.string, type: PropTypes.oneOf(['reset', 'button', 'submit']), @@ -73,13 +55,10 @@ Button.propTypes = { isRaised: PropTypes.bool, isBlock: PropTypes.bool, isRounded: PropTypes.bool, - isIconLeft: PropTypes.bool, - isIconRight: PropTypes.bool, } Button.defaultProps = { mode: undefined, - label: undefined, size: undefined, css: undefined, type: 'button', @@ -91,8 +70,6 @@ Button.defaultProps = { isRaised: false, isBlock: false, isRounded: false, - isIconLeft: false, - isIconRight: false, } export const ButtonGroup = ({ ariaLabel, children, css }) => { diff --git a/agnosticui-react/src/stories/Button.stories.js b/agnosticui-react/src/stories/Button.stories.js index af3e35d53..c8c97b451 100644 --- a/agnosticui-react/src/stories/Button.stories.js +++ b/agnosticui-react/src/stories/Button.stories.js @@ -7,70 +7,67 @@ export default { export const Primary = () => ( <> - + + + + + + ); export const Secondary = () => ( <> - + + + + + + ); export const Default = () => ( <> - + + + + + + -); +) export const Sizes = () => ( <> - + ); export const DisabledAll = () => ( <> - + + + ); export const Types = () => ( <> - + ); - export const Customizations = () => ( <> - + + -); \ No newline at end of file +); diff --git a/agnosticui-react/src/stories/Button.test.js b/agnosticui-react/src/stories/Button.test.js index a08b63d14..9de103061 100644 --- a/agnosticui-react/src/stories/Button.test.js +++ b/agnosticui-react/src/stories/Button.test.js @@ -9,8 +9,8 @@ test('onClick fires', async () => { const clickHandler = () => { state = 'click event fired' } - const { getByText } = render( + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + ) diff --git a/agnosticui-react/src/stories/ButtonIcon.stories.js b/agnosticui-react/src/stories/ButtonIcon.stories.js index 27758bee0..af1803b85 100644 --- a/agnosticui-react/src/stories/ButtonIcon.stories.js +++ b/agnosticui-react/src/stories/ButtonIcon.stories.js @@ -30,12 +30,14 @@ const SampleSvgIcon = () => { export const ButtonIcons = () => ( <>
-
-