@campxdev/shared 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/DropDownButton.tsx +165 -159
- package/src/components/Layout/Header/assets/campx_square_small.svg +9 -9
- package/src/components/Layout/Header/assets/exams_small.svg +12 -12
- package/src/components/Layout/Header/assets/hostel_small.svg +13 -13
- package/src/components/Layout/Header/assets/pay_small.svg +16 -16
- package/src/components/Layout/Header/assets/people_small.svg +9 -9
- package/src/components/SideNav.tsx +14 -16
- package/src/components/index.ts +4 -1
package/package.json
CHANGED
|
@@ -1,184 +1,190 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {KeyboardArrowDown, MoreVert} from '@mui/icons-material'
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
ButtonProps,
|
|
6
|
+
CircularProgress,
|
|
7
|
+
IconButton,
|
|
8
|
+
IconButtonProps,
|
|
9
|
+
ListItemIcon,
|
|
10
|
+
ListItemText,
|
|
11
|
+
Menu,
|
|
12
|
+
MenuItem,
|
|
13
|
+
MenuListProps,
|
|
14
|
+
MenuProps,
|
|
15
|
+
styled,
|
|
16
16
|
} from '@mui/material'
|
|
17
|
-
import {
|
|
17
|
+
import {ReactNode, useState} from 'react'
|
|
18
|
+
|
|
19
|
+
type MenuItem =
|
|
20
|
+
| {label: string | ReactNode; icon?: ReactNode; onClick: (props?: any) => any}
|
|
21
|
+
| {customButton?: ReactNode}
|
|
18
22
|
|
|
19
23
|
interface Props {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
buttonProps?: ButtonProps
|
|
33
|
-
menuProps?: Omit<MenuProps, 'open'>
|
|
34
|
-
menuListProps?: MenuListProps
|
|
35
|
-
renderMenuItems?: Array<ReactNode>
|
|
24
|
+
label?: string
|
|
25
|
+
icon?: {
|
|
26
|
+
icon: ReactNode
|
|
27
|
+
iconProps?: IconButtonProps
|
|
28
|
+
outlined?: boolean
|
|
29
|
+
}
|
|
30
|
+
loading?: boolean
|
|
31
|
+
menu: MenuItem[]
|
|
32
|
+
buttonProps?: ButtonProps
|
|
33
|
+
menuProps?: Omit<MenuProps, 'open'>
|
|
34
|
+
menuListProps?: MenuListProps
|
|
35
|
+
renderMenuItems?: Array<ReactNode>
|
|
36
36
|
}
|
|
37
37
|
const defaultIcon = {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
icon: <MoreVert color='primary' />,
|
|
39
|
+
outlined: true,
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export default function DropDownButton({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
label,
|
|
44
|
+
icon = defaultIcon,
|
|
45
|
+
menu = [],
|
|
46
|
+
buttonProps,
|
|
47
|
+
menuProps,
|
|
48
|
+
menuListProps,
|
|
49
|
+
loading = false,
|
|
50
|
+
renderMenuItems = [],
|
|
51
51
|
}: Props) {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)
|
|
53
|
+
const open = Boolean(anchorEl)
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
56
|
+
setAnchorEl(event.currentTarget)
|
|
57
|
+
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const handleClose = () => {
|
|
60
|
+
setAnchorEl(null)
|
|
61
|
+
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
{!label ? (
|
|
66
|
+
<StyledIconButton
|
|
67
|
+
outlined={icon?.outlined ?? false}
|
|
68
|
+
onClick={handleClick}
|
|
69
|
+
{...icon.iconProps}
|
|
70
|
+
>
|
|
71
|
+
{icon.icon}
|
|
72
|
+
</StyledIconButton>
|
|
73
|
+
) : (
|
|
74
|
+
<StyledDropDownButton
|
|
75
|
+
onClick={handleClick}
|
|
76
|
+
disabled={loading}
|
|
77
|
+
endIcon={
|
|
78
|
+
loading ? (
|
|
79
|
+
<CircularProgress size='20px' thickness={1.7} />
|
|
80
|
+
) : (
|
|
81
|
+
<KeyboardArrowDown />
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
{...buttonProps}
|
|
85
|
+
>
|
|
86
|
+
{label}
|
|
87
|
+
</StyledDropDownButton>
|
|
88
|
+
)}
|
|
89
|
+
<Menu
|
|
90
|
+
elevation={3}
|
|
91
|
+
id='basic-menu'
|
|
92
|
+
anchorEl={anchorEl}
|
|
93
|
+
open={open}
|
|
94
|
+
onClose={handleClose}
|
|
95
|
+
MenuListProps={{sx: {padding: 0}, ...menuListProps}}
|
|
96
|
+
anchorOrigin={{
|
|
97
|
+
vertical: 'bottom',
|
|
98
|
+
horizontal: 'right',
|
|
99
|
+
}}
|
|
100
|
+
transformOrigin={{
|
|
101
|
+
vertical: 'top',
|
|
102
|
+
horizontal: 'right',
|
|
103
|
+
}}
|
|
104
|
+
{...menuProps}
|
|
105
|
+
>
|
|
106
|
+
<RenderMenuItems
|
|
107
|
+
menu={menu}
|
|
108
|
+
renderMenuItems={renderMenuItems}
|
|
109
|
+
handleClose={handleClose}
|
|
110
|
+
/>
|
|
111
|
+
</Menu>
|
|
112
|
+
</>
|
|
113
|
+
)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
const RenderMenuItems = ({
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
116
|
+
const RenderMenuItems = ({renderMenuItems, menu, handleClose}) => {
|
|
117
|
+
if (renderMenuItems?.length) {
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
{renderMenuItems.map((Item, index) => (
|
|
121
|
+
<StyledMenuItem
|
|
122
|
+
disableRipple
|
|
123
|
+
sx={{
|
|
124
|
+
minWidth: '120px',
|
|
125
|
+
width: '100%',
|
|
126
|
+
padding: 0,
|
|
127
|
+
'&:hover': {background: 'none'},
|
|
128
|
+
}}
|
|
129
|
+
key={index}
|
|
130
|
+
>
|
|
131
|
+
{Item}
|
|
132
|
+
</StyledMenuItem>
|
|
133
|
+
))}
|
|
134
|
+
</>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
if (menu?.length) {
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
{menu.map((item, index) => (
|
|
141
|
+
<>
|
|
142
|
+
{item?.customButton ? (
|
|
143
|
+
item.customButton
|
|
144
|
+
) : (
|
|
145
|
+
<StyledMenuItem
|
|
146
|
+
sx={{minWidth: '120px', width: '100%'}}
|
|
147
|
+
key={index}
|
|
148
|
+
onClick={() => {
|
|
149
|
+
handleClose()
|
|
150
|
+
item.onClick()
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{item?.icon && <ListItemIcon>{item.icon}</ListItemIcon>}
|
|
154
|
+
<ListItemText>{item.label}</ListItemText>
|
|
155
|
+
</StyledMenuItem>
|
|
156
|
+
)}
|
|
157
|
+
</>
|
|
158
|
+
))}
|
|
159
|
+
</>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
const StyledIconButton = styled(IconButton, {
|
|
159
|
-
|
|
160
|
-
})<{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
shouldForwardProp: (prop) => prop !== 'outlined',
|
|
166
|
+
})<{outlined?: boolean}>(({theme, outlined}) => ({
|
|
167
|
+
...(outlined && {
|
|
168
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
169
|
+
borderRadius: '5px',
|
|
170
|
+
}),
|
|
165
171
|
}))
|
|
166
172
|
|
|
167
173
|
const StyledMenuItem = styled(MenuItem)(({}) => ({
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
display: 'flex',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
'& .MuiListItemIcon-root': {
|
|
177
|
+
minWidth: '24px',
|
|
178
|
+
},
|
|
179
|
+
'& .MuiSvgIcon-root': {
|
|
180
|
+
height: '18px',
|
|
181
|
+
width: '18px',
|
|
182
|
+
},
|
|
183
|
+
'& .MuiTypography-root': {
|
|
184
|
+
fontWeight: 600,
|
|
185
|
+
},
|
|
180
186
|
}))
|
|
181
187
|
|
|
182
188
|
const StyledDropDownButton = styled(Button)(({}) => ({
|
|
183
|
-
|
|
189
|
+
padding: '0 14px',
|
|
184
190
|
}))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="320" height="320.001" viewBox="0 0 320 320.001">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
-
<stop offset="0" stop-color="#596e79"/>
|
|
5
|
-
<stop offset="1" stop-color="#7c909b"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<path id="Subtraction_37" data-name="Subtraction 37" d="M2495-5403H2175v-320h320v320Zm-260-260v200h200v-200Z" transform="translate(-2175 5723)" fill="url(#linear-gradient)"/>
|
|
9
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="320" height="320.001" viewBox="0 0 320 320.001">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#596e79"/>
|
|
5
|
+
<stop offset="1" stop-color="#7c909b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<path id="Subtraction_37" data-name="Subtraction 37" d="M2495-5403H2175v-320h320v320Zm-260-260v200h200v-200Z" transform="translate(-2175 5723)" fill="url(#linear-gradient)"/>
|
|
9
|
+
</svg>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="310.624" height="320" viewBox="0 0 310.624 320">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
-
<stop offset="0" stop-color="#d86b00"/>
|
|
5
|
-
<stop offset="1" stop-color="#ed9035"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<g id="Group_4477" data-name="Group 4477" transform="translate(-342.295 -263.508)">
|
|
9
|
-
<path id="Subtraction_34" data-name="Subtraction 34" d="M310.612,320H233.034l-.016-.023L.015,320,0,319.977,38.785,266.6l.015.019L116.266,160,38.8,53.383l-.015.022L0,.024.015,0H310.609l.015.024L271.837,53.4l-.016-.022L194.354,160l77.467,106.615.016-.019,38.788,53.38-.016.022Zm-155.3-106.994-32.527,44.782,65-.04-32.476-44.742ZM122.788,62.154l32.525,44.783,32.476-44.742-65-.041Z" transform="translate(342.295 263.508)" fill="url(#linear-gradient)"/>
|
|
10
|
-
<rect id="Rectangle_4307" data-name="Rectangle 4307" width="3.696" height="133.935" transform="translate(495.759 356.565)" fill="#fff"/>
|
|
11
|
-
</g>
|
|
12
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="310.624" height="320" viewBox="0 0 310.624 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#d86b00"/>
|
|
5
|
+
<stop offset="1" stop-color="#ed9035"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4477" data-name="Group 4477" transform="translate(-342.295 -263.508)">
|
|
9
|
+
<path id="Subtraction_34" data-name="Subtraction 34" d="M310.612,320H233.034l-.016-.023L.015,320,0,319.977,38.785,266.6l.015.019L116.266,160,38.8,53.383l-.015.022L0,.024.015,0H310.609l.015.024L271.837,53.4l-.016-.022L194.354,160l77.467,106.615.016-.019,38.788,53.38-.016.022Zm-155.3-106.994-32.527,44.782,65-.04-32.476-44.742ZM122.788,62.154l32.525,44.783,32.476-44.742-65-.041Z" transform="translate(342.295 263.508)" fill="url(#linear-gradient)"/>
|
|
10
|
+
<rect id="Rectangle_4307" data-name="Rectangle 4307" width="3.696" height="133.935" transform="translate(495.759 356.565)" fill="#fff"/>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="464.103" height="320" viewBox="0 0 464.103 320">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
-
<stop offset="0" stop-color="#573dab"/>
|
|
5
|
-
<stop offset="1" stop-color="#7251dd"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<g id="Group_4511" data-name="Group 4511" transform="translate(-270.758 -251.98)">
|
|
9
|
-
<path id="Subtraction_9" data-name="Subtraction 9" d="M79.763,164.484H.016L0,164.46l39.875-54.878.015.021L118.681,1.165,157.727,54.9l.015-.021.827,1.138L79.763,164.483ZM198.442,1.137h0L197.615,0h.431l.8.58-.4.555Z" transform="translate(384.15 407.496)" fill="url(#linear-gradient)"/>
|
|
10
|
-
<path id="Union_40" data-name="Union 40" d="M79.765,320H.017L0,319.974,39.878,265.1l.013.019,78.793-108.439.185.253,34.4-47.349.016.022,78.79-108.44.389.534.239-.333L350.791,163.9l-.077.058,73.5,101.155.016-.019L464.1,319.974l-.017.023H384.339L305.533,211.531l.031-.042L265.677,156.63l-.014.019,0,0v0l-.4-.554.02-.014-7.844-10.789.1.016-25.226-34.717-39.155,53.891h-.379l-35.728,49.138L79.765,320v0ZM152.94,1.392l-1-1.367L151.96,0h1.991L152.94,1.392v0Zm158.893-.256L311.008,0h.431l.8.583-.4.554Z" transform="translate(270.757 251.98)" fill="url(#linear-gradient)"/>
|
|
11
|
-
<path id="Subtraction_10" data-name="Subtraction 10" d="M198.046,164.484h-78.52L40.883,56.246,80.756,1.366,198.845,163.9l-.8.58ZM1,1.393h0L0,.024.015,0H2.006L1,1.392Z" transform="translate(422.701 407.495)" fill="url(#linear-gradient)"/>
|
|
12
|
-
</g>
|
|
13
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="464.103" height="320" viewBox="0 0 464.103 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#573dab"/>
|
|
5
|
+
<stop offset="1" stop-color="#7251dd"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4511" data-name="Group 4511" transform="translate(-270.758 -251.98)">
|
|
9
|
+
<path id="Subtraction_9" data-name="Subtraction 9" d="M79.763,164.484H.016L0,164.46l39.875-54.878.015.021L118.681,1.165,157.727,54.9l.015-.021.827,1.138L79.763,164.483ZM198.442,1.137h0L197.615,0h.431l.8.58-.4.555Z" transform="translate(384.15 407.496)" fill="url(#linear-gradient)"/>
|
|
10
|
+
<path id="Union_40" data-name="Union 40" d="M79.765,320H.017L0,319.974,39.878,265.1l.013.019,78.793-108.439.185.253,34.4-47.349.016.022,78.79-108.44.389.534.239-.333L350.791,163.9l-.077.058,73.5,101.155.016-.019L464.1,319.974l-.017.023H384.339L305.533,211.531l.031-.042L265.677,156.63l-.014.019,0,0v0l-.4-.554.02-.014-7.844-10.789.1.016-25.226-34.717-39.155,53.891h-.379l-35.728,49.138L79.765,320v0ZM152.94,1.392l-1-1.367L151.96,0h1.991L152.94,1.392v0Zm158.893-.256L311.008,0h.431l.8.583-.4.554Z" transform="translate(270.757 251.98)" fill="url(#linear-gradient)"/>
|
|
11
|
+
<path id="Subtraction_10" data-name="Subtraction 10" d="M198.046,164.484h-78.52L40.883,56.246,80.756,1.366,198.845,163.9l-.8.58ZM1,1.393h0L0,.024.015,0H2.006L1,1.392Z" transform="translate(422.701 407.495)" fill="url(#linear-gradient)"/>
|
|
12
|
+
</g>
|
|
13
|
+
</svg>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="225.228" height="320" viewBox="0 0 225.228 320">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="linear-gradient" x1="0.222" y1="1" x2="0.787" gradientUnits="objectBoundingBox">
|
|
4
|
-
<stop offset="0" stop-color="#88b053"/>
|
|
5
|
-
<stop offset="1" stop-color="#50840b"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<g id="Group_4464" data-name="Group 4464" transform="translate(-1597.6 -781.55)">
|
|
9
|
-
<g id="Group_4461" data-name="Group 4461" transform="translate(1597.6 781.55)">
|
|
10
|
-
<g id="Group_4460" data-name="Group 4460" transform="translate(0 0)">
|
|
11
|
-
<path id="Subtraction_8" data-name="Subtraction 8" d="M79.79,164.485,198.873.58l-.8-.58H119.553L39.916,109.605l-.015-.022L.026,164.462l.015.023H79.79Z" transform="translate(26.355 155.515)" fill="url(#linear-gradient)"/>
|
|
12
|
-
<path id="Subtraction_8-2" data-name="Subtraction 8" d="M119.109,0,.026,163.9l.8.58H79.346L158.983,54.88,159,54.9,198.873.023,198.858,0H119.109Z" transform="translate(-0.026 0)" fill="url(#linear-gradient)"/>
|
|
13
|
-
</g>
|
|
14
|
-
</g>
|
|
15
|
-
</g>
|
|
16
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="225.228" height="320" viewBox="0 0 225.228 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.222" y1="1" x2="0.787" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#88b053"/>
|
|
5
|
+
<stop offset="1" stop-color="#50840b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4464" data-name="Group 4464" transform="translate(-1597.6 -781.55)">
|
|
9
|
+
<g id="Group_4461" data-name="Group 4461" transform="translate(1597.6 781.55)">
|
|
10
|
+
<g id="Group_4460" data-name="Group 4460" transform="translate(0 0)">
|
|
11
|
+
<path id="Subtraction_8" data-name="Subtraction 8" d="M79.79,164.485,198.873.58l-.8-.58H119.553L39.916,109.605l-.015-.022L.026,164.462l.015.023H79.79Z" transform="translate(26.355 155.515)" fill="url(#linear-gradient)"/>
|
|
12
|
+
<path id="Subtraction_8-2" data-name="Subtraction 8" d="M119.109,0,.026,163.9l.8.58H79.346L158.983,54.88,159,54.9,198.873.023,198.858,0H119.109Z" transform="translate(-0.026 0)" fill="url(#linear-gradient)"/>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="426.29" height="320.001" viewBox="0 0 426.29 320.001">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
-
<stop offset="0" stop-color="#d0002b"/>
|
|
5
|
-
<stop offset="1" stop-color="#ea4a6b"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
</defs>
|
|
8
|
-
<path id="Union_42" data-name="Union 42" d="M-1429.646-7174l-50.322-69.259-9.444,13,40.5,55.514-1.027.747h-182.829l-.021-.03,40.96-56.372-9.342-12.857L-1651.493-7174h-102.486l-.021-.03,51.243-70.524.019.026,101.257-139.358.5.683,0,0,60.424,82.832,60.775-82.837.006.008.306-.421,151.761,208.879-1.027.747Zm-92.314-279.665v0A40.334,40.334,0,0,1-1481.627-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1521.96-7453.664Zm-119.905,0v0A40.334,40.334,0,0,1-1601.532-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1641.865-7453.664Z" transform="translate(1753.999 7494)" fill="url(#linear-gradient)"/>
|
|
9
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="426.29" height="320.001" viewBox="0 0 426.29 320.001">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#d0002b"/>
|
|
5
|
+
<stop offset="1" stop-color="#ea4a6b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<path id="Union_42" data-name="Union 42" d="M-1429.646-7174l-50.322-69.259-9.444,13,40.5,55.514-1.027.747h-182.829l-.021-.03,40.96-56.372-9.342-12.857L-1651.493-7174h-102.486l-.021-.03,51.243-70.524.019.026,101.257-139.358.5.683,0,0,60.424,82.832,60.775-82.837.006.008.306-.421,151.761,208.879-1.027.747Zm-92.314-279.665v0A40.334,40.334,0,0,1-1481.627-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1521.96-7453.664Zm-119.905,0v0A40.334,40.334,0,0,1-1601.532-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1641.865-7453.664Z" transform="translate(1753.999 7494)" fill="url(#linear-gradient)"/>
|
|
9
|
+
</svg>
|
|
@@ -52,7 +52,7 @@ const RenderMenuItem = ({menuItem}) => {
|
|
|
52
52
|
const permissions = PermissionsStore.useState((s) => s).permissions
|
|
53
53
|
const hasAccess = permissionKey ? permissions[permissionKey] : accessIfNoKey
|
|
54
54
|
|
|
55
|
-
if (!hasAccess) return null
|
|
55
|
+
if (!hasAccess && !children?.length) return null
|
|
56
56
|
if (children?.length)
|
|
57
57
|
return (
|
|
58
58
|
<Box
|
|
@@ -86,24 +86,22 @@ const DropDownMenu = ({path, title, icon, menuItems, permissionKey}) => {
|
|
|
86
86
|
const [open, setOpen] = useState(false)
|
|
87
87
|
const permissions = PermissionsStore.useState((s) => s).permissions
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
const validateDropdownAccess = () => {
|
|
90
|
+
if (accessIfNoKey && !permissions) return true
|
|
91
|
+
let arr = []
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
for (let i = 0; i < menuItems.length; i++) {
|
|
94
|
+
if (permissions[menuItems[i].permissionKey]) {
|
|
95
|
+
arr.push(true)
|
|
96
|
+
} else {
|
|
97
|
+
arr.push(accessIfNoKey)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
return arr.includes(true)
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// if (!dropdownAccess) return null
|
|
104
|
+
if (!validateDropdownAccess()) return null
|
|
107
105
|
return (
|
|
108
106
|
<>
|
|
109
107
|
<Box
|
package/src/components/index.ts
CHANGED
|
@@ -21,7 +21,8 @@ import { ListItemButton } from "./ListItemButton";
|
|
|
21
21
|
import LayoutWrapper from "./LayoutWrapper";
|
|
22
22
|
import PageNotFound from "./PageNotFound";
|
|
23
23
|
import ChangePassword from "./ChangePassword";
|
|
24
|
-
|
|
24
|
+
import UploadButton from "./UploadButton";
|
|
25
|
+
import DialogWrapper from "./DrawerWrapper/DialogWrapper";
|
|
25
26
|
export { default as Image } from "./Image";
|
|
26
27
|
export { default as PageHeader } from "./PageHeader";
|
|
27
28
|
export { PageContent } from "./PageContent";
|
|
@@ -71,6 +72,8 @@ export {
|
|
|
71
72
|
PageNotFound,
|
|
72
73
|
SideNav,
|
|
73
74
|
ChangePassword,
|
|
75
|
+
UploadButton,
|
|
76
|
+
DialogWrapper,
|
|
74
77
|
};
|
|
75
78
|
|
|
76
79
|
export * from "./UploadButton/types";
|