Skip to content

Commit

Permalink
refactor: update background color integration (#1985)
Browse files Browse the repository at this point in the history
  • Loading branch information
booc0mtaco authored Jun 10, 2024
1 parent d6ccc8d commit f6e280f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 30 deletions.
20 changes: 8 additions & 12 deletions src/components/Button/Button-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ export const InverseRanks: StoryObj<Args> = {
...DefaultRanks.args,
variant: 'inverse',
},
parameters: {
backgrounds: { default: 'background-utility-default-high-emphasis' },
},
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>
),
],
decorators: [(Story) => <div className="p-1">{Story()}</div>],
};

/**
Expand All @@ -145,13 +143,11 @@ export const InverseDisabledRanks: StoryObj<Args> = {
variant: 'inverse',
isDisabled: true,
},
parameters: {
backgrounds: { default: 'background-utility-default-high-emphasis' },
},
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>
),
],
decorators: [(Story) => <div className="p-1">{Story()}</div>],
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/__snapshots__/Button-v2.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ exports[`<Button /> (v2) IconLayouts story renders snapshot 1`] = `

exports[`<Button /> (v2) InverseDisabledRanks story renders snapshot 1`] = `
<div
class="bg-[var(--eds-color-blue-850)] p-1"
class="p-1"
>
<div
class="flex gap-1"
Expand Down Expand Up @@ -289,7 +289,7 @@ exports[`<Button /> (v2) InverseDisabledRanks story renders snapshot 1`] = `

exports[`<Button /> (v2) InverseRanks story renders snapshot 1`] = `
<div
class="bg-[var(--eds-color-blue-850)] p-1"
class="p-1"
>
<div
class="flex gap-1"
Expand Down
10 changes: 5 additions & 5 deletions src/components/Link/Link-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ export const Emphasis: StoryObj<Args> = {
/**
* We also include an inverse variant, for use on dark backgrounds.
*/
export const Inverse: StoryObj<Args> = {
export const InverseVariant: StoryObj<Args> = {
args: {
variant: 'inverse',
},
// TODO: find a cleaner way to decorate with unavailable tokens using parameters:backgounds:
parameters: {
backgrounds: { default: 'background-utility-default-high-emphasis' },
},
decorators: [
(Story) => (
<div className="w-96 bg-[var(--eds-color-blue-850)] p-1 text-center text-utility-inverse">
{Story()}
</div>
<div className="w-96 p-1 text-center text-utility-inverse">{Story()}</div>
),
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Link/__snapshots__/Link-v2.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ exports[`<Link /> InheritColor story renders snapshot 1`] = `
</div>
`;

exports[`<Link /> Inverse story renders snapshot 1`] = `
exports[`<Link /> InverseVariant story renders snapshot 1`] = `
<div
class="text-utility-default-primary"
>
<div
class="w-96 bg-[var(--eds-color-blue-850)] p-1 text-center text-utility-inverse"
class="w-96 p-1 text-center text-utility-inverse"
>
<a
class="link link--emphasis-default link--size-lg link--variant-inverse"
Expand Down
10 changes: 3 additions & 7 deletions src/components/TabGroup/TabGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const Default: StoryObj<Args> = {
* TabGroups have an inverted variant, for use on dark backgrounds. Depending on how the background is applied, you can use
* text color tokens to style the individual tabs in the group.
*/
export const Inverted: StoryObj<Args> = {
export const InverseVariant: StoryObj<Args> = {
args: {
variant: 'inverse',
children: (
Expand Down Expand Up @@ -164,14 +164,10 @@ export const Inverted: StoryObj<Args> = {
</>
),
},
// 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>
),
],
decorators: [(Story) => <div className="p-1">{Story()}</div>],
parameters: {
...Default.parameters,
backgrounds: { default: 'background-utility-default-high-emphasis' },
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/TabGroup/__snapshots__/TabGroup.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ exports[`<TabGroup /> Default story renders snapshot 1`] = `
</div>
`;

exports[`<TabGroup /> Inverted story renders snapshot 1`] = `
exports[`<TabGroup /> InverseVariant story renders snapshot 1`] = `
<div
class="bg-[var(--eds-color-blue-850)] p-1"
class="p-1"
>
<div
class="tabs"
Expand Down

0 comments on commit f6e280f

Please sign in to comment.