Skip to content

Commit

Permalink
fix(Button): add in missing inverse disabled treatments (#1976)
Browse files Browse the repository at this point in the history
- fix up the styling for border on disabled inverse button
- add styles for remaining inverse disabled ranks
- add stories
  • Loading branch information
booc0mtaco authored Jun 6, 2024
1 parent 78d173e commit 8389f35
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/components/Button/Button-v2.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@

.button--primary.button--variant-inverse.button--disabled {
color: var(--eds-theme-color-text-utility-inverse-disabled);
border-color: var(--eds-theme-color-background-utility-inverse-disabled);
/* Using transparent for border color to avoid blending opacity of border and background */
border-color: transparent;
background-color: var(--eds-theme-color-background-utility-inverse-disabled);

pointer-events: none;
Expand All @@ -288,6 +289,13 @@
pointer-events: none;
}

.button--secondary.button--variant-inverse.button--disabled {
color: var(--eds-theme-color-text-utility-inverse-disabled);
border-color: var(--eds-theme-color-border-utility-inverse-disabled);

pointer-events: none;
}

.button--tertiary.button--variant-default.button--disabled,
.button--tertiary.button--variant-critical.button--disabled,
.button--tertiary.button--variant-neutral.button--disabled {
Expand All @@ -297,6 +305,13 @@
pointer-events: none;
}

.button--tertiary.button--variant-inverse.button--disabled {
color: var(--eds-theme-color-text-utility-disabled-primary);
border-color: transparent;

pointer-events: none;
}

/**
* States
*/
Expand Down
18 changes: 18 additions & 0 deletions src/components/Button/Button-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@ export const InverseRanks: StoryObj<Args> = {
],
};

/**
* Inverse buttons can be disabled as well
*/
export const InverseDisabledRanks: StoryObj<Args> = {
args: {
...DefaultRanks.args,
variant: 'inverse',
isDisabled: true,
},
render: DefaultRanks.render,
// TODO: find a cleaner way to decorate with unavailable tokens using parameters:backgounds:
decorators: [
(Story) => (
<div className="bg-[var(--eds-color-blue-850)] p-1">{Story()}</div>
),
],
};

/**
* Buttons come in three sizes
*/
Expand Down
44 changes: 44 additions & 0 deletions src/components/Button/__snapshots__/Button-v2.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,50 @@ exports[`<Button /> (v2) IconLayouts story renders snapshot 1`] = `
</div>
`;

exports[`<Button /> (v2) InverseDisabledRanks story renders snapshot 1`] = `
<div
class="bg-[var(--eds-color-blue-850)] p-1"
>
<div
class="flex gap-1"
>
<button
class="button button--layout-none button--disabled button--primary button--lg button--variant-inverse"
disabled=""
type="button"
>
<span
class="button__text"
>
Primary
</span>
</button>
<button
class="button button--layout-none button--disabled button--secondary button--lg button--variant-inverse"
disabled=""
type="button"
>
<span
class="button__text"
>
Secondary
</span>
</button>
<button
class="button button--layout-none button--disabled button--tertiary button--lg button--variant-inverse"
disabled=""
type="button"
>
<span
class="button__text"
>
Tertiary
</span>
</button>
</div>
</div>
`;

exports[`<Button /> (v2) InverseRanks story renders snapshot 1`] = `
<div
class="bg-[var(--eds-color-blue-850)] p-1"
Expand Down

0 comments on commit 8389f35

Please sign in to comment.