Skip to content

Commit

Permalink
Feat(web): Introduce Plain Button #DS-1454
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen authored and literat committed Nov 22, 2024
1 parent 2c7ccdd commit 260b247
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/web/src/scss/components/Button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Variants:
<button type="button" class="Button Button--primary Button--medium">Primary Button</button>
<button type="button" class="Button Button--secondary Button--medium">Secondary Button</button>
<button type="button" class="Button Button--tertiary Button--medium">Tertiary Button</button>
<button type="button" class="Button Button--plain Button--medium">Plain Button</button>
<button type="button" class="Button Button--success Button--medium">Success button</button>
<button type="button" class="Button Button--informative Button--medium">Informative button</button>
<button type="button" class="Button Button--warning Button--medium">Warning button</button>
Expand Down
14 changes: 8 additions & 6 deletions packages/web/src/scss/components/Button/_Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
background-color: var(--#{tokens.$css-variable-prefix}button-background-color-state-active);
}

&:disabled,
&.is-disabled,
&.Button--disabled {
&:is(:disabled, .is-disabled, .Button--disabled) {
pointer-events: none;
cursor: cursors.$disabled;
}
Expand Down Expand Up @@ -72,14 +70,18 @@
padding-inline: 0;
}

.Button:disabled:not(.Button--loading),
.Button.is-disabled:not(.Button--loading),
.Button.Button--disabled:not(.Button--loading) {
.Button:is(:disabled, .is-disabled, .Button--disabled):not(.Button--loading) {
color: theme.$disabled-color;
border-color: theme.$disabled-border-color;
background-color: theme.$disabled-background-color;
}

// We need to override the default disabled styles for plain buttons, because we want them to be still plain.
.Button--plain:is(:disabled, .is-disabled, .Button--disabled):not(.Button--loading) {
border-color: transparent;
background-color: transparent;
}

.Button.Button--loading {
position: relative;
overflow: hidden; // 1.
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/scss/components/Button/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#> web/layout/default title="Button" parentPageName="Components" }}

{{setVar "colors" "primary" "secondary" "tertiary" "success" "informative" "warning" "danger" }}
{{setVar "colors" "primary" "secondary" "tertiary" "plain" "success" "informative" "warning" "danger" }}
{{setVar "sizes" "small" "medium" "large" }}

<section class="UNSTABLE_Section">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 260b247

Please sign in to comment.