Skip to content

Commit

Permalink
Use simpler rest parameter syntax instead of Object.assign for defini…
Browse files Browse the repository at this point in the history
…ng KuiButton propTypes.
  • Loading branch information
cjcenizal committed Mar 28, 2017
1 parent 24a9a4f commit 4119bfb
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ui_framework/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ const commonPropTypes = {
isDisabled: PropTypes.bool,
onClick: PropTypes.func,
data: PropTypes.any,
className: PropTypes.oneOfType([
PropTypes.string,
PropTypes.array,
PropTypes.object,
]),
className: PropTypes.string,
};

const getIcon = props => (
Expand Down Expand Up @@ -85,12 +81,13 @@ const KuiButton = props => {
);
};

KuiButton.propTypes = Object.assign({}, commonPropTypes, {
KuiButton.propTypes = {
icon: PropTypes.node,
isIconOnRight: PropTypes.bool,
children: PropTypes.node,
isLoading: PropTypes.bool,
});
...commonPropTypes,
};

const KuiLinkButton = props => {
const icon = getIcon(props);
Expand All @@ -108,14 +105,15 @@ const KuiLinkButton = props => {
);
};

KuiLinkButton.propTypes = Object.assign({}, commonPropTypes, {
KuiLinkButton.propTypes = {
href: PropTypes.string,
target: PropTypes.string,
icon: PropTypes.node,
isIconOnRight: PropTypes.bool,
children: PropTypes.node,
isLoading: PropTypes.bool,
});
...commonPropTypes,
};

const KuiSubmitButton = props => {
const commonProps = getCommonProps(props);
Expand All @@ -129,9 +127,10 @@ const KuiSubmitButton = props => {
);
};

KuiSubmitButton.propTypes = Object.assign({}, commonPropTypes, {
KuiSubmitButton.propTypes = {
children: PropTypes.string,
});
...commonPropTypes,
};

KuiButton.TYPE = KuiSubmitButton.TYPE = KuiLinkButton.TYPE = keyMirror({
BASIC: null,
Expand Down

0 comments on commit 4119bfb

Please sign in to comment.