Skip to content

Commit

Permalink
[OP-152] Rename btn-delete to btn-destructive (#222)
Browse files Browse the repository at this point in the history
This PR renames the delete button to destructive as that is more general but still conveys intent. `btn-delete` is kept for backwards compatibility.
  • Loading branch information
Jeremy-Walton authored Feb 16, 2024
1 parent 99987e2 commit 0473616
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
}
}

.btn-destructive,
.btn-delete {
@extend %btn-global;

Expand Down
2 changes: 2 additions & 0 deletions src/components/button_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

.btn,
.btn-primary,
.btn-destructive,
.btn-delete,
.btn-warning {
+ .btn,
+ .btn-primary,
+ .btn-destructive,
+ .btn-delete,
+ .btn-warning {
margin-left: -1px;
Expand Down
11 changes: 6 additions & 5 deletions src/stories/Components/Button/Button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ Button can be used as a standalone component, however, it does have a few depend

<Canvas of={ButtonStories.Primary} />

### Delete
### Destructive

`.btn-delete` Provides a filled button using the red danger color. This should be used as a destructive action such as delete.
`.btn-destructive` Provides a filled button using the red danger color. This should be used as a destructive action such as delete.
Note: `.btn-delete` also works for backwards compatibility, but `.btn-destructive` is the preferred class name.

<Canvas of={ButtonStories.Delete} />
<Canvas of={ButtonStories.Destructive} />

### Active

Expand All @@ -56,9 +57,9 @@ Button can be used as a standalone component, however, it does have a few depend

### No Border

`.btn--no-border` This is a modifier which can be used with all button classes except delete. It provides a button with no border, but the same sizing and adapts it's color to all the btn variations.
`.btn--no-border` This is a modifier which can be used with all button classes except destructive. It provides a button with no border, but the same sizing and adapts it's color to all the btn variations.

Note: `.btn-delete` and `.btn-warning` do not support the `.btn--no-border` modifier. Borderless warning or delete buttons is not considered a good pattern and can easily lead to confusion so it has been disabled.
Note: `.btn-destructive` and `.btn-warning` do not support the `.btn--no-border` modifier. Borderless warning or destructive buttons is not considered a good pattern and can easily lead to confusion so it has been disabled.

<Canvas of={ButtonStories.NoBorder} />

Expand Down
6 changes: 3 additions & 3 deletions src/stories/Components/Button/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
label: { control: 'text' },
priority: {
control: { type: 'select' },
options: ['default', 'primary', 'delete', 'warning'],
options: ['default', 'primary', 'destructive', 'warning'],
},
noBorder: { control: 'boolean' },
disabled: { control: 'boolean' },
Expand Down Expand Up @@ -47,10 +47,10 @@ export const Primary = {
},
}

export const Delete = {
export const Destructive = {
args: {
label: 'Delete',
priority: 'delete',
priority: 'destructive',
},
}

Expand Down
4 changes: 2 additions & 2 deletions src/stories/Components/ButtonGroup/ButtonGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ Button Group can be used as a standalone component, however, it does have a few

<Canvas of={ButtonGroupStories.Primary} />

### Delete
### Destructive

<Canvas of={ButtonGroupStories.Delete} />
<Canvas of={ButtonGroupStories.Destructive} />

### Warning

Expand Down
8 changes: 4 additions & 4 deletions src/stories/Components/ButtonGroup/ButtonGroup.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
argTypes: {
priority: {
control: { type: 'select' },
options: ['default', 'primary', 'delete', 'warning'],
options: ['default', 'primary', 'destructive', 'warning'],
},
noBorder: { control: 'boolean' },
active: { control: 'boolean' },
Expand Down Expand Up @@ -41,9 +41,9 @@ export const Primary = {
},
}

export const Delete = {
export const Destructive = {
args: {
priority: 'delete',
priority: 'destructive',
},
}

Expand All @@ -55,7 +55,7 @@ export const Warning = {

export const Active = {
args: {
priority: 'delete',
priority: 'destructive',
active: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/stories/Components/ConfirmDialog/ConfirmDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const createConfirmDialog = ({ title, message, inlineDemo = false }) => {
</div>
<div class='confirm-dialog__footer'>
<button class="btn">Cancel</button>
<button class='btn-delete'>Yes, I'm Sure</button>
<button class='btn-destructive'>Yes, I'm Sure</button>
</div>
</div>
`
Expand Down

0 comments on commit 0473616

Please sign in to comment.