From 3e5ca9c9444573add5bcd7d9e519bb89fcaa196b Mon Sep 17 00:00:00 2001 From: "bit-dev-bot[bot]" Date: Thu, 25 Jun 2020 12:32:41 +0000 Subject: [PATCH 1/4] chore(deps): update bit component guya-ltd.gcss/atoms/button --- .bitmap | 18 +++++++-------- src/components/atoms/Button/Button.js | 23 +++++++++++++++---- .../atoms/Button/_Link/ButtonLink.js | 4 ++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.bitmap b/.bitmap index 3ab6e70..28a5702 100644 --- a/.bitmap +++ b/.bitmap @@ -1,27 +1,27 @@ /* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */ { - "guya-ltd.gcss/atoms/button@0.0.1": { + "guya-ltd.gcss/atoms/button@0.0.2": { "files": [ { + "name": "Button.js", "relativePath": "src/components/atoms/Button/Button.js", - "test": false, - "name": "Button.js" + "test": false }, { + "name": "ButtonLink.js", "relativePath": "src/components/atoms/Button/_Link/ButtonLink.js", - "test": false, - "name": "ButtonLink.js" + "test": false }, { + "name": "ButtonIcon.js", "relativePath": "src/components/atoms/Button/__Icon/ButtonIcon.js", - "test": false, - "name": "ButtonIcon.js" + "test": false }, { + "name": "index.js", "relativePath": "src/components/atoms/Button/index.js", - "test": false, - "name": "index.js" + "test": false } ], "mainFile": "src/components/atoms/Button/index.js", diff --git a/src/components/atoms/Button/Button.js b/src/components/atoms/Button/Button.js index 42b7aba..0068340 100644 --- a/src/components/atoms/Button/Button.js +++ b/src/components/atoms/Button/Button.js @@ -24,7 +24,7 @@ import ButtonIcon from './__Icon/ButtonIcon'; class Button extends Component { render() { /* Props */ - const {bsPrefix, children, size, type, href, icon} = this.props; + const {bsPrefix, children, size, type, href, icon, theme} = this.props; /* Class name generator */ const cn = withNaming({ e: '__', m: '', v: '--' }) @@ -32,11 +32,19 @@ class Button extends Component { /* Set base classname */ let classname = cn(bsPrefix) + /* Theme */ + let themeName; + + if(theme) + themeName = ' '.concat('theme-', theme) + else + themeName = '' + if(href && type === 'link') - return + return else return ( - @@ -80,7 +88,13 @@ Button.propTypes = { * @property {node} * @default null */ - icon: PropTypes.node + icon: PropTypes.node, + /** + * @description Theme. + * @enum {('theme-red'|'theme-royal-blue')} + * @default null + */ + theme: PropTypes.oneOf(['red', 'royal-blue']), } Button.defaultProps = { @@ -90,6 +104,7 @@ Button.defaultProps = { type: 'button', href: null, icon: null, + theme: null, } /** diff --git a/src/components/atoms/Button/_Link/ButtonLink.js b/src/components/atoms/Button/_Link/ButtonLink.js index 3253842..211dd07 100644 --- a/src/components/atoms/Button/_Link/ButtonLink.js +++ b/src/components/atoms/Button/_Link/ButtonLink.js @@ -16,11 +16,11 @@ import React from 'react'; * @example */ -const ButtonLink = ({cn, href, children}) => { +const ButtonLink = ({cn, theme, href, children}) => { /* Class names collection */ const classname = cn({'': 'link'}) - return {children} + return {children} } /** From 9df3ceb7478a8cf50647693935d53661d6c3e0b2 Mon Sep 17 00:00:00 2001 From: "bit-dev-bot[bot]" Date: Fri, 26 Jun 2020 10:57:02 +0000 Subject: [PATCH 2/4] chore(deps): update bit component guya-ltd.gcss/atoms/button --- .bitmap | 2 +- src/components/atoms/Button/Button.js | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.bitmap b/.bitmap index 28a5702..b8575a3 100644 --- a/.bitmap +++ b/.bitmap @@ -1,7 +1,7 @@ /* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */ { - "guya-ltd.gcss/atoms/button@0.0.2": { + "guya-ltd.gcss/atoms/button@0.0.3": { "files": [ { "name": "Button.js", diff --git a/src/components/atoms/Button/Button.js b/src/components/atoms/Button/Button.js index 0068340..ebbcc22 100644 --- a/src/components/atoms/Button/Button.js +++ b/src/components/atoms/Button/Button.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { withNaming } from '@bem-react/classname' +import { withNaming } from '@bem-react/classname'; +import { classnames } from '@bem-react/classnames' import ButtonLink from './_Link/ButtonLink'; import ButtonIcon from './__Icon/ButtonIcon'; @@ -24,7 +25,7 @@ import ButtonIcon from './__Icon/ButtonIcon'; class Button extends Component { render() { /* Props */ - const {bsPrefix, children, size, type, href, icon, theme} = this.props; + const {bsPrefix, children, size, type, href, icon, theme, variant} = this.props; /* Class name generator */ const cn = withNaming({ e: '__', m: '', v: '--' }) @@ -40,11 +41,18 @@ class Button extends Component { else themeName = '' + /* Classnames */ + const classnametext = classnames( + classname({'': size}), + classname({'': variant}), + themeName + ); + if(href && type === 'link') return else return ( - @@ -94,7 +102,13 @@ Button.propTypes = { * @enum {('theme-red'|'theme-royal-blue')} * @default null */ - theme: PropTypes.oneOf(['red', 'royal-blue']), + theme: PropTypes.oneOf(['theme-red', 'theme-royal-blue']), + /** + * @description Variant colors. + * @enum {('primary'|'success'|'warning'|'danger')} + * @default null + */ + variant: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']), } Button.defaultProps = { From cebef63ccb5dee3f763c03148d0a2a78a53d95d6 Mon Sep 17 00:00:00 2001 From: "bit-dev-bot[bot]" Date: Fri, 26 Jun 2020 11:52:41 +0000 Subject: [PATCH 3/4] chore(deps): update bit component guya-ltd.gcss/atoms/button --- .bitmap | 2 +- src/components/atoms/Button/Button.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bitmap b/.bitmap index b8575a3..e5cb211 100644 --- a/.bitmap +++ b/.bitmap @@ -1,7 +1,7 @@ /* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */ { - "guya-ltd.gcss/atoms/button@0.0.3": { + "guya-ltd.gcss/atoms/button@0.0.4": { "files": [ { "name": "Button.js", diff --git a/src/components/atoms/Button/Button.js b/src/components/atoms/Button/Button.js index ebbcc22..52779d5 100644 --- a/src/components/atoms/Button/Button.js +++ b/src/components/atoms/Button/Button.js @@ -25,7 +25,7 @@ import ButtonIcon from './__Icon/ButtonIcon'; class Button extends Component { render() { /* Props */ - const {bsPrefix, children, size, type, href, icon, theme, variant} = this.props; + const {bsPrefix, children, size, type, href, icon, theme, variant, block} = this.props; /* Class name generator */ const cn = withNaming({ e: '__', m: '', v: '--' }) @@ -33,18 +33,17 @@ class Button extends Component { /* Set base classname */ let classname = cn(bsPrefix) - /* Theme */ - let themeName; + /* Theme name */ + const themeName = theme ? 'theme-' + theme : null - if(theme) - themeName = ' '.concat('theme-', theme) - else - themeName = '' + /* Block name */ + const blockName = block ? 'block' : null; /* Classnames */ const classnametext = classnames( classname({'': size}), classname({'': variant}), + classname({'': blockName}), themeName ); @@ -109,6 +108,7 @@ Button.propTypes = { * @default null */ variant: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']), + block: PropTypes.bool, } Button.defaultProps = { From 00cfc9a32474bfae6c2842404933614fec97ef01 Mon Sep 17 00:00:00 2001 From: "bit-dev-bot[bot]" Date: Wed, 16 Dec 2020 08:47:17 +0000 Subject: [PATCH 4/4] chore(deps): update bit component guya-ltd.gcss/atoms/button --- .bitmap | 2 +- src/components/atoms/Button/Button.js | 14 ++++++++++---- src/components/atoms/Button/_Link/ButtonLink.js | 13 ++++++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.bitmap b/.bitmap index e5cb211..7b43e11 100644 --- a/.bitmap +++ b/.bitmap @@ -1,7 +1,7 @@ /* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */ { - "guya-ltd.gcss/atoms/button@0.0.4": { + "guya-ltd.gcss/atoms/button@0.0.7": { "files": [ { "name": "Button.js", diff --git a/src/components/atoms/Button/Button.js b/src/components/atoms/Button/Button.js index 52779d5..55640ee 100644 --- a/src/components/atoms/Button/Button.js +++ b/src/components/atoms/Button/Button.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { withNaming } from '@bem-react/classname'; -import { classnames } from '@bem-react/classnames' +import { classnames } from '@bem-react/classnames'; import ButtonLink from './_Link/ButtonLink'; import ButtonIcon from './__Icon/ButtonIcon'; @@ -25,7 +25,7 @@ import ButtonIcon from './__Icon/ButtonIcon'; class Button extends Component { render() { /* Props */ - const {bsPrefix, children, size, type, href, icon, theme, variant, block} = this.props; + const {bsPrefix, children, size, type, href, icon, theme, variant, block, onClick} = this.props; /* Class name generator */ const cn = withNaming({ e: '__', m: '', v: '--' }) @@ -48,10 +48,10 @@ class Button extends Component { ); if(href && type === 'link') - return + return else return ( - @@ -109,6 +109,12 @@ Button.propTypes = { */ variant: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']), block: PropTypes.bool, + /** + * @description On click function + * @property {element} + * @default null + */ + onClick: PropTypes.element, } Button.defaultProps = { diff --git a/src/components/atoms/Button/_Link/ButtonLink.js b/src/components/atoms/Button/_Link/ButtonLink.js index 211dd07..0d0e199 100644 --- a/src/components/atoms/Button/_Link/ButtonLink.js +++ b/src/components/atoms/Button/_Link/ButtonLink.js @@ -1,4 +1,5 @@ import React from 'react'; +import { classnames } from '@bem-react/classnames'; /** * A Button Link component represents an object or entity. @@ -16,11 +17,17 @@ import React from 'react'; * @example */ -const ButtonLink = ({cn, theme, href, children}) => { +const ButtonLink = ({cn, theme, href, children, size, variant}) => { /* Class names collection */ - const classname = cn({'': 'link'}) + const classname = classnames( + cn({'': 'link'}), + cn({'': size}), + cn({'': variant}), + theme + ) + - return {children} + return {children} } /**