source: src/components/custom-popover/custom-popover.tsx@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 1.2 KB
Line 
1// @mui
2import { menuItemClasses } from '@mui/material/MenuItem';
3import Popover, { PopoverOrigin } from '@mui/material/Popover';
4//
5import { getPosition } from './utils';
6import { StyledArrow } from './styles';
7import { MenuPopoverProps } from './types';
8
9// ----------------------------------------------------------------------
10
11export default function CustomPopover({
12 open,
13 children,
14 arrow = 'top-right',
15 hiddenArrow,
16 sx,
17 ...other
18}: MenuPopoverProps) {
19 const { style, anchorOrigin, transformOrigin } = getPosition(arrow);
20
21 return (
22 <Popover
23 open={Boolean(open)}
24 anchorEl={open}
25 anchorOrigin={anchorOrigin as PopoverOrigin}
26 transformOrigin={transformOrigin as PopoverOrigin}
27 slotProps={{
28 paper: {
29 sx: {
30 width: 'auto',
31 overflow: 'inherit',
32 ...style,
33 [`& .${menuItemClasses.root}`]: {
34 '& svg': {
35 mr: 2,
36 flexShrink: 0,
37 },
38 },
39 ...sx,
40 },
41 },
42 }}
43 {...other}
44 >
45 {!hiddenArrow && <StyledArrow arrow={arrow} />}
46
47 {children}
48 </Popover>
49 );
50}
Note: See TracBrowser for help on using the repository browser.