Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Dec 23, 2024
1 parent 09e8faf commit ae77955
Showing 1 changed file with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { iconSlotSpace } from '../private/iconSlotSpace';
import { badgeSlotSpace } from '../private/badgeSlotSpace';
import { virtualTouchable } from '../private/touchable/virtualTouchable.css';
import { DefaultBadgePropsProvider } from '../Badge/defaultBadgeProps';
import { Inline } from '../Inline/Inline';

const {
MENU_ITEM_UP,
Expand Down Expand Up @@ -181,19 +180,25 @@ export function MenuItemLeftSlot({ children }: { children?: ReactNode }) {
const iconSpace = useBraidTheme().legacy ? 'small' : iconSlotSpace;

return (
<Box position="relative" paddingRight={iconSpace}>
<Inline component="span" alignY="center" space="none">
<Box className={styles.menuItemLeftSlot}>
<Box component="span" display="block" className={iconSize({ size })}>
&nbsp;
</Box>
<Box
component="span"
position="relative"
display="flex"
alignItems="center"
paddingRight={iconSpace}
>
<Box
component="span"
display="block"
className={[iconSize({ size }), styles.menuItemLeftSlot]}
>
&nbsp;
</Box>
{children ? (
<Box component="span" position="absolute" display="flex">
{children}
</Box>
{children ? (
<Box position="absolute" display="flex">
{children}
</Box>
) : null}
</Inline>
) : null}
</Box>
);
}
Expand Down Expand Up @@ -229,7 +234,7 @@ function MenuItemChildren({
const { size, reserveIconSpace } = menuRendererContext;

return (
<Inline component="span" alignY="center" space="none">
<Box component="span" display="flex" alignItems="center" minWidth={0}>
{!formElement && (icon || reserveIconSpace) ? (
<MenuItemLeftSlot>
<Text
Expand Down Expand Up @@ -259,6 +264,6 @@ function MenuItemChildren({
<DefaultBadgePropsProvider bleedY>{badge}</DefaultBadgePropsProvider>
</Box>
) : null}
</Inline>
</Box>
);
}

0 comments on commit ae77955

Please sign in to comment.