Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Button): add in missing inverse disabled treatments #1976

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading