Skip to content

Commit

Permalink
feat(button): fallback for buttonlink
Browse files Browse the repository at this point in the history
  • Loading branch information
OlenaKashuba committed Jul 10, 2024
1 parent afe5307 commit b20a95f
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ coverage
*.iml

.DS_Store

*.idea
25 changes: 20 additions & 5 deletions src/components/atoms/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,29 @@ const colorMap = {
primary: {
text: colors.white,
bg: colors.action,
hover: {
bg: `linear-gradient(90deg, #3B46C4 0%, #2732B0 100%)`,
text: colors.white,
border: `1px solid ${colors.action}`,
},
},
secondary: {
text: colors.actionDark,
bg: colors.actionLight,
hover: {
bg: '#EEEFFB',
text: colors.actionDark,
border: '1px solid #EEEFFB',
},
},
link: {
text: colors.actionDark,
bg: 'transparent',
hover: {
bg: '#EAEBFA',
text: colors.actionDark,
border: '1px solid #EAEBFA',
},
},
};

Expand Down Expand Up @@ -95,13 +110,13 @@ export const buttonStyle = css<BaseButtonProps>`
background: ${activeBg ?? colorMap[styling].bg};
}
&:hover {
background: ${hoverBg};
color: ${hoverText};
border: ${hoverBorder};
background: ${hoverBg ?? colorMap[styling].hover.bg};
color: ${hoverText ?? colorMap[styling].hover.text};
border: ${hoverBorder ?? colorMap[styling].hover.border};
}
&:focus:not(:active) {
border: ${focusBorder};
box-shadow: ${focusBoxShadow};
border: ${focusBorder ?? `1px solid ${colors.white}`};
box-shadow: ${focusBoxShadow ?? `0 0 4px ${colors.actionPlain}`};
}
`;
return disabled ? disabledStyles : enabledStyles;
Expand Down
76 changes: 36 additions & 40 deletions src/components/atoms/Button/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@ exports[`<Button /> renders as "link" 1`] = `
letter-spacing: 0;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c0:active {
opacity: 0.8;
box-shadow: unset;
color: #21247F;
border: 1px solid transparent;
background: transparent;
}
.c0:hover {
background: #EAEBFA;
color: #21247F;
border: 1px solid #EAEBFA;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
Expand Down Expand Up @@ -92,19 +96,23 @@ exports[`<Button /> renders as "secondary" 1`] = `
letter-spacing: 0;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c0:active {
opacity: 0.8;
box-shadow: unset;
color: #21247F;
border: 1px solid transparent;
background: #E9EAFA;
}
.c0:hover {
background: #EEEFFB;
color: #21247F;
border: 1px solid #EEEFFB;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
Expand Down Expand Up @@ -155,11 +163,6 @@ exports[`<Button /> renders disabled 1`] = `
border: 1px solid transparent;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
class="c0"
disabled=""
Expand Down Expand Up @@ -206,11 +209,6 @@ exports[`<Button /> renders loading as "primary" 1`] = `
cursor: not-allowed;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
class="c0"
disabled=""
Expand Down Expand Up @@ -264,11 +262,6 @@ exports[`<Button /> renders loading as "secondary" 1`] = `
cursor: not-allowed;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
class="c0"
disabled=""
Expand Down Expand Up @@ -322,11 +315,6 @@ exports[`<Button /> renders loading as "secondary" 2`] = `
cursor: not-allowed;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
class="c0"
disabled=""
Expand Down Expand Up @@ -381,19 +369,23 @@ exports[`<Button /> renders wide 1`] = `
background-color: #3B46C4;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c0:active {
opacity: 0.8;
box-shadow: unset;
color: #FFFFFF;
border: 1px solid transparent;
background: linear-gradient(90deg,#4F5AD8 0%,#3B46C4 100%);
}
.c0:hover {
background: linear-gradient(90deg,#3B46C4 0%,#2732B0 100%);
color: #FFFFFF;
border: 1px solid linear-gradient(90deg,#4F5AD8 0%,#3B46C4 100%);
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
Expand Down Expand Up @@ -440,19 +432,23 @@ exports[`<Button /> renders with no a11y violations 1`] = `
background-color: #3B46C4;
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c0:active {
opacity: 0.8;
box-shadow: unset;
color: #FFFFFF;
border: 1px solid transparent;
background: linear-gradient(90deg,#4F5AD8 0%,#3B46C4 100%);
}
.c0:hover {
background: linear-gradient(90deg,#3B46C4 0%,#2732B0 100%);
color: #FFFFFF;
border: 1px solid linear-gradient(90deg,#4F5AD8 0%,#3B46C4 100%);
}
.c0:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,23 @@ exports[`<BankDetails /> renders the component with no props and no a11y violati
letter-spacing: 0;
}
.c4:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c4:active {
opacity: 0.8;
box-shadow: unset;
color: #21247F;
border: 1px solid transparent;
background: transparent;
}
.c4:hover {
background: #EAEBFA;
color: #21247F;
border: 1px solid #EAEBFA;
}
.c4:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c0 {
Expand Down
14 changes: 9 additions & 5 deletions src/components/molecules/Help/__snapshots__/Help.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,23 @@ exports[`<Help /> renders the default Help component with no a11y violations 1`]
letter-spacing: 0;
}
.c15:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
.c15:active {
opacity: 0.8;
box-shadow: unset;
color: #21247F;
border: 1px solid transparent;
background: #E9EAFA;
}
.c15:hover {
background: #EEEFFB;
color: #21247F;
border: 1px solid #EEEFFB;
}
.c15:focus:not(:active) {
border: 1px solid #FFFFFF;
box-shadow: 0 0 4px #3B46C4;
}
@media (min-width:0px) {
Expand Down
Loading

0 comments on commit b20a95f

Please sign in to comment.