Skip to content

Commit

Permalink
Move chakra Menu around the real menu, and fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
csandman committed Jul 24, 2023
1 parent c25e501 commit 852b139
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/chakra-components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import React from "react";
import type { IconProps } from "@chakra-ui/icon";
import Icon from "@chakra-ui/icon";
import { Box } from "@chakra-ui/layout";
import { MenuIcon } from "@chakra-ui/menu";
import { Menu as ChakraMenu, MenuIcon } from "@chakra-ui/menu";
import type { SystemStyleObject } from "@chakra-ui/system";
import { useColorModeValue, useMultiStyleConfig } from "@chakra-ui/system";
import { Menu as ChakraMenu } from '@chakra-ui/menu'
import type {
CoercedMenuPlacement,
GroupBase,
Expand Down Expand Up @@ -50,14 +49,16 @@ const Menu = <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
: initialSx;

return (
<Box
{...innerProps}
ref={innerRef}
className={cx({ menu: true }, className)}
sx={sx}
>
{children}
</Box>
<ChakraMenu>
<Box
{...innerProps}
ref={innerRef}
className={cx({ menu: true }, className)}
sx={sx}
>
{children}
</Box>
</ChakraMenu>
);
};

Expand Down Expand Up @@ -450,16 +451,13 @@ export const Option = <
aria-disabled={isDisabled ? true : undefined}
>
{showCheckIcon && (
{/* Need to provide Menu Context to MenuIcon */}
<ChakraMenu>
<MenuIcon
fontSize="0.8em"
marginEnd="0.75rem"
opacity={isSelected ? 1 : 0}
>
<CheckIcon />
</MenuIcon>
</ChakraMenu>
<MenuIcon
fontSize="0.8em"
marginEnd="0.75rem"
opacity={isSelected ? 1 : 0}
>
<CheckIcon />
</MenuIcon>
)}
{children}
</Box>
Expand Down

0 comments on commit 852b139

Please sign in to comment.