ISSUE-005 - Further work on Workspaces. Re-using MenuItem component and figuring out a new method for hover-over highlighting using SASS & selection.

This commit is contained in:
Kyle Geib committed 2022-01-07 12:47:12 -05:00
1 parent 02132bdbe2
commit 5dcc3f3940
10 files changed
+87 -32

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import styled, { css } from "styled-components";
import { PadBox } from "@bedrock-layout/padbox";
const hoverRules = css`
background: ${p => p.theme.colors.darkGrey};
color: white;
`;
export type MenuItemProps = {
isHovered?: boolean,
isActive?: boolean,
};
export const MenuItem = styled(PadBox).attrs(() => ({
padding: ["sm", "lg"],
})) <MenuItemProps>`
border-radius: ${p => p.theme.design.button.borderRadius};
color: ${p => p.theme.colors.darkGrey};
font-family: ${p => p.theme.fonts.f1Regular};
font-size: 0.8em;
${({ isActive }) => isActive && css`
background: ${p => p.theme.colors.lightGrey};
`}
${({ isHovered }) => {
// My cheap way of having uncontrolled hover behavior.
if (isHovered == null) {
return css`
&:hover {
${hoverRules}
}
`;
} else if (isHovered === true) {
return hoverRules;
}
}}
`;