Skip to content

Commit

Permalink
Update textColor on button for over and active states only if provide…
Browse files Browse the repository at this point in the history
…d a custom color (#367)

chore(baseline): update lost-pixel baselines (#368)
  • Loading branch information
juliewongbandue authored Sep 29, 2023
1 parent f20362f commit ed83363
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Binary file modified lost-pixel/baseline/components-button-examples--growth-cta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/Button/Button.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default {
href: { control: { disable: true } },
icon: { control: { disable: true } },
target: { control: { disable: true } },
color: { control: 'color', type: 'color' },
children: {
control: {
type: 'text',
Expand Down
8 changes: 6 additions & 2 deletions src/components/Button/Button.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,12 @@ function buttonVariants({
const borderColor = color;

const contrastText = textColor || a11yColor(color);
const contrastTextHover = textColor || a11yColor(hoverColor);
const contrastTextActive = textColor || a11yColor(activeColor);
const contrastTextHover = customColor
? readableColor(hoverColor)
: a11yColor(hoverColor);
const contrastTextActive = customColor
? readableColor(activeColor)
: a11yColor(activeColor);

switch (variant) {
case 'outline':
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/examples/Growth.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function GrowthCTA({ args }) {
<Button
size="xl"
icon={<Pencil />}
color={{ color: '#E0FF2B', textColor: 'blue' }}
color={{ color: '#E0FF2B' }}
>
Create videos
</Button>
Expand Down

0 comments on commit ed83363

Please sign in to comment.