fix: No reserved space for submenu arrow

fix: Submenu arrow miss-positioned when menu is scrollable
closes #3191
This commit is contained in:
Tom Moor
2022-03-03 22:40:12 -08:00
parent 7e930dd1c9
commit 4f0ee2c3f8
2 changed files with 9 additions and 3 deletions

View File

@@ -93,11 +93,14 @@ const Spacer = styled.svg`
flex-shrink: 0; flex-shrink: 0;
`; `;
export const MenuAnchorCSS = css<{ type MenuAnchorProps = {
level?: number; level?: number;
disabled?: boolean; disabled?: boolean;
dangerous?: boolean; dangerous?: boolean;
}>` disclosure?: boolean;
};
export const MenuAnchorCSS = css<MenuAnchorProps>`
display: flex; display: flex;
margin: 0; margin: 0;
border: 0; border: 0;
@@ -114,6 +117,7 @@ export const MenuAnchorCSS = css<{
cursor: default; cursor: default;
user-select: none; user-select: none;
white-space: nowrap; white-space: nowrap;
position: relative;
svg:not(:last-child) { svg:not(:last-child) {
margin-right: 4px; margin-right: 4px;
@@ -145,6 +149,8 @@ export const MenuAnchorCSS = css<{
${breakpoint("tablet")` ${breakpoint("tablet")`
padding: 4px 12px; padding: 4px 12px;
padding-right: ${(props: MenuAnchorProps) =>
props.disclosure ? 32 : 12}px;
font-size: 14px; font-size: 14px;
`}; `};
`; `;

View File

@@ -53,7 +53,7 @@ const Submenu = React.forwardRef(
<> <>
<MenuButton ref={ref} {...menu} {...rest}> <MenuButton ref={ref} {...menu} {...rest}>
{(props) => ( {(props) => (
<MenuAnchor {...props}> <MenuAnchor disclosure {...props}>
{title} <Disclosure color={theme.textTertiary} /> {title} <Disclosure color={theme.textTertiary} />
</MenuAnchor> </MenuAnchor>
)} )}