Adjust dropdown styling

This commit is contained in:
jeffvli 2023-01-07 03:49:56 -08:00
parent 1b25d88692
commit af1c16ee51
4 changed files with 32 additions and 15 deletions

View file

@ -26,13 +26,27 @@ const StyledMenuLabel = styled(MantineMenu.Label)<MenuLabelProps>`
`;
const StyledMenuItem = styled(MantineMenu.Item)<MenuItemProps>`
padding: 0.8rem;
font-size: 0.9em;
position: relative;
padding: var(--dropdown-menu-item-padding);
font-size: var(--dropdown-menu-item-font-size);
font-family: var(--content-font-family);
background-color: ${({ $isActive }) => {
if (!$isActive) return undefined;
return 'var(--dropdown-menu-bg-hover)';
}};
${(props) =>
props.$isActive &&
`
&::before {
content: ''; // ::before and ::after both require content
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--primary-color);
opacity: 0.2;
z-index: -1;
}
`}
&:disabled {
opacity: 0.6;
@ -56,6 +70,8 @@ const StyledMenuItem = styled(MantineMenu.Item)<MenuItemProps>`
display: flex;
margin-left: 2rem !important;
}
cursor: default;
`;
const StyledMenuDropdown = styled(MantineMenu.Dropdown)`
@ -73,13 +89,12 @@ export const DropdownMenu = ({ children, ...props }: MenuProps) => {
return (
<StyledMenu
withinPortal
radius="sm"
styles={{
dropdown: {
filter: 'drop-shadow(0 0 5px rgb(0, 0, 0, 50%))',
},
}}
transition="scale-y"
transition="fade"
{...props}
>
{children}

View file

@ -27,7 +27,7 @@ export const Popover = ({ children, ...props }: PopoverProps) => {
filter: 'drop-shadow(0 0 5px rgb(0, 0, 0, 50%))',
},
}}
transition="scale-y"
transition="fade"
{...props}
>
{children}

View file

@ -64,7 +64,7 @@ export const Select = ({ width, maxWidth, ...props }: SelectProps) => {
},
}}
sx={{ maxWidth, width }}
transition="pop"
transition="fade"
transitionDuration={100}
{...props}
/>
@ -126,7 +126,7 @@ export const MultiSelect = ({ width, maxWidth, ...props }: MultiSelectProps) =>
},
}}
sx={{ maxWidth, width }}
transition="pop"
transition="fade"
transitionDuration={100}
{...props}
/>

View file

@ -63,11 +63,13 @@
--input-active-fg: rgb(193, 193, 193);
--input-active-bg: rgba(255, 255, 255, 0.1);
--dropdown-menu-bg: rgb(36, 36, 36);
--dropdown-menu-fg: rgb(220, 220, 220);
--dropdown-menu-bg-hover: rgb(46, 46, 46);
--dropdown-menu-bg: rgb(40, 40, 40);
--dropdown-menu-fg: rgb(235, 235, 235);
--dropdown-menu-item-padding: 1rem 0.8rem;
--dropdown-menu-item-font-size: 0.9em;
--dropdown-menu-bg-hover: rgb(62, 62, 62);
--dropdown-menu-border: none;
--dropdown-menu-border-radius: 4px;
--dropdown-menu-border-radius: 2px;
--switch-track-bg: rgb(50, 50, 50);
--switch-track-enabled-bg: var(--primary-color);