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

LG-4289: Updates IconButton hover state #2401

Merged
merged 3 commits into from
Jun 18, 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
5 changes: 5 additions & 0 deletions .changeset/afraid-ravens-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/icon-button': patch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch works, but I could also argue minor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come minor?

---

Changes hover state of IconButton components
3 changes: 2 additions & 1 deletion packages/icon-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@leafygreen-ui/icon": "^12.0.1",
"@leafygreen-ui/lib": "^13.3.0",
"@leafygreen-ui/palette": "^4.0.9",
"@leafygreen-ui/tokens": "^2.5.2"
"@leafygreen-ui/tokens": "^2.5.2",
"polished": "^4.2.2"
},
"peerDependencies": {
"@leafygreen-ui/leafygreen-provider": "^3.1.12"
Expand Down
18 changes: 8 additions & 10 deletions packages/icon-button/src/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { transparentize } from 'polished';

import { css } from '@leafygreen-ui/emotion';
import { Theme } from '@leafygreen-ui/lib';
import { palette } from '@leafygreen-ui/palette';
Expand Down Expand Up @@ -35,14 +37,12 @@ export const baseIconButtonStyle = css`
left: 0;
right: 0;
border-radius: 100%;
opacity: 0;
transform: scale(0.8);
}

&:active:before,
&:hover:before,
&:focus:before {
opacity: 1;
transform: scale(1);
}

Expand Down Expand Up @@ -75,7 +75,7 @@ export const iconButtonMode: Record<Theme, string> = {
color: ${palette.black};

&:before {
background-color: ${palette.gray.light2};
background-color: ${transparentize(0.9, palette.gray.dark2)};
}
}
`,
Expand All @@ -87,7 +87,7 @@ export const iconButtonMode: Record<Theme, string> = {
color: ${palette.gray.light3};

&:before {
background-color: ${palette.gray.dark2};
background-color: ${transparentize(0.9, palette.gray.light2)};
}
}
`,
Expand All @@ -100,7 +100,7 @@ export const focusStyle: Record<Theme, string> = {
box-shadow: ${focusRing[Theme.Light].default};

&:before {
background-color: ${palette.gray.light2};
background-color: ${transparentize(0.9, palette.gray.dark2)};
}
}
`,
Expand All @@ -110,7 +110,7 @@ export const focusStyle: Record<Theme, string> = {
box-shadow: ${focusRing[Theme.Dark].default};

&:before {
background-color: ${palette.gray.dark1};
background-color: ${transparentize(0.9, palette.gray.light2)};
}
}
`,
Expand Down Expand Up @@ -169,17 +169,15 @@ export const activeStyle: Record<Theme, string> = {
color: ${palette.black};

&:before {
background-color: ${palette.gray.light2};
opacity: 1;
background-color: ${transparentize(0.9, palette.gray.dark2)};
transform: scale(1);
}
`,
[Theme.Dark]: css`
color: ${palette.gray.light3};

&:before {
background-color: ${palette.gray.dark1};
opacity: 1;
background-color: ${transparentize(0.9, palette.gray.light2)};
transform: scale(1);
}
`,
Expand Down
Loading