source: src/components/custom-popover/styles.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: 2.1 KB
RevLine 
[5d6f37a]1// @mui
2import { styled, alpha } from '@mui/material/styles';
3// theme
4import { bgBlur } from 'src/theme/css';
5//
6import { MenuPopoverArrowValue } from './types';
7
8// ----------------------------------------------------------------------
9
10export const StyledArrow = styled('span')<{ arrow: MenuPopoverArrowValue }>(({ arrow, theme }) => {
11 const SIZE = 14;
12
13 const POSITION = -(SIZE / 2) + 0.5;
14
15 const topStyle = {
16 top: POSITION,
17 transform: 'rotate(135deg)',
18 };
19
20 const bottomStyle = {
21 bottom: POSITION,
22 transform: 'rotate(-45deg)',
23 };
24
25 const leftStyle = {
26 left: POSITION,
27 transform: 'rotate(45deg)',
28 };
29
30 const rightStyle = {
31 right: POSITION,
32 transform: 'rotate(-135deg)',
33 };
34
35 return {
36 width: SIZE,
37 height: SIZE,
38 position: 'absolute',
39 borderBottomLeftRadius: SIZE / 4,
40 clipPath: 'polygon(0% 0%, 100% 100%, 0% 100%)',
41 border: `solid 1px ${alpha(
42 theme.palette.mode === 'light' ? theme.palette.grey[500] : theme.palette.common.black,
43 0.12
44 )}`,
45 ...bgBlur({
46 color: theme.palette.background.paper,
47 }),
48 // Top
49 ...(arrow === 'top-left' && { ...topStyle, left: 20 }),
50 ...(arrow === 'top-center' && {
51 ...topStyle,
52 left: 0,
53 right: 0,
54 margin: 'auto',
55 }),
56 ...(arrow === 'top-right' && { ...topStyle, right: 20 }),
57 // Bottom
58 ...(arrow === 'bottom-left' && { ...bottomStyle, left: 20 }),
59 ...(arrow === 'bottom-center' && {
60 ...bottomStyle,
61 left: 0,
62 right: 0,
63 margin: 'auto',
64 }),
65 ...(arrow === 'bottom-right' && { ...bottomStyle, right: 20 }),
66 // Left
67 ...(arrow === 'left-top' && { ...leftStyle, top: 20 }),
68 ...(arrow === 'left-center' && {
69 ...leftStyle,
70 top: 0,
71 bottom: 0,
72 margin: 'auto',
73 }),
74 ...(arrow === 'left-bottom' && { ...leftStyle, bottom: 20 }),
75 // Right
76 ...(arrow === 'right-top' && { ...rightStyle, top: 20 }),
77 ...(arrow === 'right-center' && {
78 ...rightStyle,
79 top: 0,
80 bottom: 0,
81 margin: 'auto',
82 }),
83 ...(arrow === 'right-bottom' && { ...rightStyle, bottom: 20 }),
84 };
85});
Note: See TracBrowser for help on using the repository browser.