From 2e8d27404781145fc63acdbce7b20838e57dd22b Mon Sep 17 00:00:00 2001 From: "Taushanova-Atanasova, Inna" Date: Fri, 28 Dec 2018 15:28:56 -0500 Subject: [PATCH 01/10] Issue#93: adds className and spread props for Button and ActionBar --- src/ActionBar/ActionBar.Component.js | 6 ++--- src/ActionBar/ActionBar.js | 30 +++++++++++----------- src/Button/Button.Component.js | 14 +++++------ src/Button/Button.js | 37 ++++++++++++++-------------- 4 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/ActionBar/ActionBar.Component.js b/src/ActionBar/ActionBar.Component.js index dc81d87d5..5a4b2ac75 100644 --- a/src/ActionBar/ActionBar.Component.js +++ b/src/ActionBar/ActionBar.Component.js @@ -4,7 +4,7 @@ import { DocsTile, DocsText, Separator, Header, Description, Import, Properties export const ActionBarComponent = () => { const actionBarBackBtnCode = ` - + @@ -115,7 +115,7 @@ const clickBackBtn = () => { description: 'string - Action bar description. Specified in ActionBarHeader.' }, { - name: 'onclick', + name: 'onClick', description: 'func - The function that is executed when the back button is clicked.' } ]} /> @@ -125,7 +125,7 @@ const clickBackBtn = () => {

Action bar with back button, description and action buttons.

- + diff --git a/src/ActionBar/ActionBar.js b/src/ActionBar/ActionBar.js index d8d405646..578324c04 100644 --- a/src/ActionBar/ActionBar.js +++ b/src/ActionBar/ActionBar.js @@ -1,44 +1,44 @@ import React from 'react'; import PropTypes from 'prop-types'; -export const ActionBar = props => { - const { mobile, width, children } = props; +export const ActionBar = ({ mobile, width, children, className, ...props }) => { return ( {mobile ? (
-
{children}
+
{children}
) : ( -
{children}
+
{children}
)}
); }; ActionBar.propTypes = { + className: PropTypes.string, mobile: PropTypes.bool, width: PropTypes.string }; -export const ActionBarBack = props => { - const { onclick } = props; +export const ActionBarBack = ({ onClick, className, ...props }) => { + return ( -
-
); }; ActionBarBack.propTypes = { - onclick: PropTypes.func + className: PropTypes.string, + onClick: PropTypes.func }; -export const ActionBarHeader = props => { - const { title, description } = props; +export const ActionBarHeader = ({ title, description, className, ...props }) => { return ( -
+

{title}

{description}

@@ -46,11 +46,11 @@ export const ActionBarHeader = props => { }; ActionBarHeader.propTypes = { + className: PropTypes.string, description: PropTypes.string, title: PropTypes.string }; -export const ActionBarActions = props => { - const { children } = props; - return
{children}
; +export const ActionBarActions = ({ children, className, ...props }) => { + return
{children}
; }; diff --git a/src/Button/Button.Component.js b/src/Button/Button.Component.js index ec0354cdd..02208e24f 100644 --- a/src/Button/Button.Component.js +++ b/src/Button/Button.Component.js @@ -3,11 +3,11 @@ import { Button, ButtonGroup } from '../'; import { DocsTile, DocsText, Separator, Header, Description, Import, Properties, Playground } from '../'; export const ButtonComponent = () => { - const buttonOptionsCode = ` - - + + const clickBtnHandler = btn => { alert(\`You clicked the \${btn} Button\`); @@ -155,7 +155,7 @@ const clickBtnHandler = btn => { description: 'bool - selected state of the button. Enabled by setting selected property to true.' }, - { name: 'onclick', description: 'func - The function that is executed when the button is clicked.' } + { name: 'onClick', description: 'func - The function that is executed when the button is clicked.' } ]} /> @@ -171,11 +171,11 @@ const clickBtnHandler = btn => {
- - - + +
{buttonOptionsCode} diff --git a/src/Button/Button.js b/src/Button/Button.js index a50d2c93f..4015dd643 100644 --- a/src/Button/Button.js +++ b/src/Button/Button.js @@ -1,20 +1,21 @@ import React from 'react'; import PropTypes from 'prop-types'; -export const Button = props => { - const { - option, - type, - compact, - glyph, - dropdown, - navbar, - selected, - disabled, - typeAttr, - onclick, - children - } = props; +export const Button = ({ + option, + type, + compact, + glyph, + dropdown, + navbar, + selected, + disabled, + typeAttr, + onClick, + children, + className, + ...props +}) => { return ( ); @@ -39,11 +40,11 @@ Button.propTypes = { dropdown: PropTypes.bool, glyph: PropTypes.string, navbar: PropTypes.bool, - onclick: PropTypes.func, option: PropTypes.oneOf(['', 'emphasized', 'light', 'shell']), selected: PropTypes.bool, type: PropTypes.oneOf(['', 'standard', 'positive', 'negative', 'medium']), - typeAttr: PropTypes.string + typeAttr: PropTypes.string, + onClick: PropTypes.func }; export const ButtonGroup = props => { From f351c572e52c4f8ac8eaa26d01953df1d0377159 Mon Sep 17 00:00:00 2001 From: "Taushanova-Atanasova, Inna" Date: Fri, 28 Dec 2018 15:49:02 -0500 Subject: [PATCH 02/10] Issue#93: adds className and spread props for Alert and Status Indicators --- src/Alert/Alert.js | 7 ++++--- src/Badge/Badge.js | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Alert/Alert.js b/src/Alert/Alert.js index 308af265e..f88a40f21 100644 --- a/src/Alert/Alert.js +++ b/src/Alert/Alert.js @@ -16,16 +16,16 @@ export class Alert extends Component { } render() { - const { type, link, linkText, dismissable, children } = this.props; + const { type, link, linkText, dismissable, children, className, ...props } = this.props; return (
{this.state.isActive && ( ); @@ -38,7 +38,7 @@ ActionBarBack.propTypes = { export const ActionBarHeader = ({ title, description, className, ...props }) => { return ( -
+

{title}

{description}

@@ -52,5 +52,5 @@ ActionBarHeader.propTypes = { }; export const ActionBarActions = ({ children, className, ...props }) => { - return
{children}
; + return
{children}
; }; diff --git a/src/Alert/__snapshots__/Alert.test.js.snap b/src/Alert/__snapshots__/Alert.test.js.snap index e7e94490e..372fdb5a7 100644 --- a/src/Alert/__snapshots__/Alert.test.js.snap +++ b/src/Alert/__snapshots__/Alert.test.js.snap @@ -4,7 +4,6 @@ exports[` create basic alert 1`] = `