Skip to content

Commit

Permalink
fix(Button): unwind button proptype abstraction (#4581)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpicone authored Nov 6, 2019
1 parent 10f2fae commit 4ebfa5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { settings } from 'carbon-components';
import { ButtonTypes } from '../../prop-types/types';
import { ButtonKinds } from '../../prop-types/types';
import deprecate from '../../prop-types/deprecate';

const { prefix } = settings;
Expand Down Expand Up @@ -142,7 +142,7 @@ Button.propTypes = {
/**
* Specify the kind of Button you want to create
*/
kind: ButtonTypes.buttonKind.isRequired,
kind: PropTypes.oneOf(ButtonKinds).isRequired,

/**
* Optionally specify an href for your Button to become an <a> element
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@carbon/icons-react';
import Loading from '../Loading';
import uid from '../../tools/uniqueId';
import { ButtonTypes } from '../../prop-types/types';
import { ButtonKinds } from '../../prop-types/types';

const { prefix } = settings;

Expand Down Expand Up @@ -88,7 +88,7 @@ export class FileUploaderButton extends Component {
/**
* Specify the type of underlying button
*/
buttonKind: ButtonTypes.buttonKind,
buttonKind: PropTypes.oneOf(ButtonKinds),

/**
* Specify the types of files that this input should be able to receive
Expand Down Expand Up @@ -269,7 +269,7 @@ export default class FileUploader extends Component {
/**
* Specify the type of the <FileUploaderButton>
*/
buttonKind: ButtonTypes.buttonKind,
buttonKind: PropTypes.oneOf(ButtonKinds),

/**
* Specify the status of the File Upload
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/ModalWrapper/ModalWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import Modal from '../Modal';
import Button from '../Button';
import { ButtonTypes } from '../../prop-types/types';
import { ButtonKinds } from '../../prop-types/types';

export default class ModalWrapper extends React.Component {
static propTypes = {
Expand All @@ -34,7 +34,7 @@ export default class ModalWrapper extends React.Component {
PropTypes.object,
]),
triggerButtonIconDescription: PropTypes.string,
triggerButtonKind: ButtonTypes.buttonKind,
triggerButtonKind: PropTypes.oneOf(ButtonKinds),
shouldCloseAfterSubmit: PropTypes.bool,
};

Expand Down
20 changes: 8 additions & 12 deletions packages/react/src/prop-types/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

import { oneOf } from 'prop-types';

export const ButtonTypes = {
buttonKind: oneOf([
'primary',
'secondary',
'danger',
'ghost',
'danger--primary',
'tertiary',
]),
};
export const ButtonKinds = [
'primary',
'secondary',
'danger',
'ghost',
'danger--primary',
'tertiary',
];

0 comments on commit 4ebfa5a

Please sign in to comment.