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

Update Menu hover state #1410

Merged
merged 13 commits into from
Jun 17, 2021
2 changes: 1 addition & 1 deletion libraries/core-react/src/components/Menu/Menu.tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { ComponentToken } from '@equinor/eds-tokens'
const {
colors: {
ui: {
background__light: { rgba: hoverBackground },
background__default: { rgba: background },
},
interactive: {
Expand All @@ -13,6 +12,7 @@ const {
focus: { rgba: focusColor },
disabled__fill: { rgba: disabledIconColor },
disabled__text: { rgba: disabledTextColor },
table__header__fill_hover: { rgba: hoverBackground },
},
text: {
static_icons__default: { rgba: textColor },
Expand Down
13 changes: 12 additions & 1 deletion libraries/core-react/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@ type MenuPaperProps = {
open: boolean
}

const { border } = tokens

const MenuPaper = styled(Paper)<MenuPaperProps>`
position: absolute;
z-index: 150;
width: fit-content;
min-width: fit-content;
${bordersTemplate(tokens.border)};
${bordersTemplate(border)};
${({ open }) => css({ visibility: open ? null : 'hidden' })}

li:first-child {
border-top-left-radius: ${border.type === 'border' && border.radius};
border-top-right-radius: ${border.type === 'border' && border.radius};
}
li:last-child {
border-bottom-left-radius: ${border.type === 'border' && border.radius};
border-bottom-right-radius: ${border.type === 'border' && border.radius};
}
`
type MenuContainerProps = MenuProps & {
containerEl: HTMLElement
Expand Down