Skip to content

Commit

Permalink
Button: fix misaligned clickbounds (equinor#3397)
Browse files Browse the repository at this point in the history
* πŸ› Button (round): fix misaligned clickbound

* πŸ”₯ Button: remove pointless ::before element

* πŸ“Έ Update snapshots
  • Loading branch information
oddvernes authored and mhwaage committed Jun 11, 2024
1 parent ed880e0 commit 8c670aa
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 60 deletions.
9 changes: 0 additions & 9 deletions packages/eds-core-react/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ const ButtonBase = styled.button(({ theme }: { theme: ButtonToken }) => {
${bordersTemplate(theme.border)}
${typographyTemplate(theme.typography)}
&::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
&::after {
position: absolute;
top: -${clickbound?.offset?.top};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ exports[`Button Matches snapshot 1`] = `
justify-self: center;
}
.c0::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
.c0::after {
position: absolute;
top: -7px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ const contained_icon = {
clickbound: {
width: clicboundHeight,
offset: {
top: '0',
left: `${(parseInt(clicboundHeight) - parseInt('40px')) / 2}px`,
top: `${
(parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2
}px`,
left: `${
(parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2
}px`,
},
},
states: {
Expand Down
4 changes: 3 additions & 1 deletion packages/eds-core-react/src/components/Button/tokens/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export const primary = mergeDeepRight(button, {
clickbound: {
width: clicboundHeight,
offset: {
top: '0',
top: `${
(parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2
}px`,
left: `${
(parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2
}px`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,9 @@ exports[`Pagination Matches snapshot 1`] = `
justify-self: center;
}
.c3::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
.c3::after {
position: absolute;
top: -0;
top: -4px;
left: -4px;
width: 48px;
height: 48px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,9 @@ exports[`Sidebar Matches snapshot 1`] = `
justify-self: center;
}
.c3::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
.c3::after {
position: absolute;
top: -0;
top: -4px;
left: -4px;
width: 48px;
height: 48px;
Expand Down Expand Up @@ -202,15 +193,6 @@ exports[`Sidebar Matches snapshot 1`] = `
justify-self: center;
}
.c7::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
.c7::after {
position: absolute;
top: -7px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,9 @@ exports[`SideSheet Matches snapshot 1`] = `
justify-self: center;
}
.c3::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}
.c3::after {
position: absolute;
top: -0;
top: -4px;
left: -4px;
width: 48px;
height: 48px;
Expand Down

0 comments on commit 8c670aa

Please sign in to comment.