Skip to content

Commit

Permalink
fix(button): remove exclusivity of type props
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper-joe committed Nov 23, 2023
1 parent d2440f3 commit d73fa39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
11 changes: 4 additions & 7 deletions components/button/src/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ Button.propTypes = {
*/
dataTest: PropTypes.string,
/**
* Indicates that the button makes potentially dangerous
* deletions or data changes.
* Mutually exclusive with `primary` prop
* Applies 'destructive' button appearance, implying a dangerous action.
*/
destructive: sharedPropTypes.buttonVariantPropType,
destructive: PropTypes.bool,
/** Applies a greyed-out appearance and makes the button non-interactive */
disabled: PropTypes.bool,
/** An icon element to display inside the button */
Expand All @@ -121,10 +119,9 @@ Button.propTypes = {
*/
name: PropTypes.string,
/**
* Applies 'primary' button appearance.
* Mutually exclusive with `destructive` prop
* Applies 'primary' button appearance, implying the most important action.
*/
primary: sharedPropTypes.buttonVariantPropType,
primary: PropTypes.bool,
/**
* Applies 'secondary' button appearance.
*/
Expand Down
22 changes: 0 additions & 22 deletions constants/src/shared-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,6 @@ export const statusArgType = {
control: { type: 'boolean' },
}

/**
* Button variant propType
* @return {PropType} Mutually exclusive variants:
* primary/destructive
*/
export const buttonVariantPropType = mutuallyExclusive(
['primary', 'destructive'],
PropTypes.bool
)
export const buttonVariantArgType = {
// No description because it should be set for the component description
table: {
type: {
summary: 'bool',
detail: "'primary' and 'destructive' are mutually exclusive props",
},
},
control: {
type: 'boolean',
},
}

/**
* Size variant propType
* @return {PropType} Mutually exclusive variants:
Expand Down

0 comments on commit d73fa39

Please sign in to comment.