@bytebrand/fe-ui-core 4.1.36 → 4.1.38
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/source/components/_common/IconSVG/IconSVGConfig.tsx +2 -0
- package/source/components/_common/IconSVG/SVG/common/TrashRed.tsx +23 -0
- package/source/components/_common/Modal/Modal.story.js +21 -0
- package/source/components/_common/Modal/Modal.styled.tsx +12 -0
- package/source/components/_common/Modal/Modal.tsx +24 -0
- package/source/components/_common/Modal/ModalsConfig.tsx +11 -0
- package/source/components/_common/Modal/modals/TestModal.tsx +7 -0
- package/source/components/_common/UserMenu/MaterialMenu.story.js +10 -10
- package/source/components/_common/UserMenu/MaterialMenu.tsx +1 -2
- package/source/framework/hooks/useModal.ts +13 -0
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import Star from './SVG/common/Star';
|
|
|
17
17
|
import Plus from './SVG/common/Plus';
|
|
18
18
|
import PlusNew from './SVG/common/PlusNew';
|
|
19
19
|
import Trash from './SVG/common/Trash';
|
|
20
|
+
import TrashRed from './SVG/common/TrashRed';
|
|
20
21
|
import Question from './SVG/common/Question';
|
|
21
22
|
import Info from './SVG/common/Info';
|
|
22
23
|
import InfoTransparentIcon from './SVG/common/InfoTransparent';
|
|
@@ -315,6 +316,7 @@ const components: IComponentsProp = {
|
|
|
315
316
|
plus: Plus,
|
|
316
317
|
plusNew: PlusNew,
|
|
317
318
|
trash: Trash,
|
|
319
|
+
trashRed: TrashRed,
|
|
318
320
|
trashIcon: Trash,
|
|
319
321
|
selector_unknown: Question,
|
|
320
322
|
info: Info,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
const SvgTrash = (props: any) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="25"
|
|
7
|
+
height="24"
|
|
8
|
+
viewBox="0 0 25 24"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{ ...props }
|
|
12
|
+
>
|
|
13
|
+
<mask id="mask0_7785_64413" maskUnits="userSpaceOnUse" x="0" y="0" width="25" height="24">
|
|
14
|
+
<rect x="0.666992" width="24" height="24" fill="#D9D9D9"/>
|
|
15
|
+
</mask>
|
|
16
|
+
<g mask="url(#mask0_7785_64413)">
|
|
17
|
+
<path d="M7.96699 20.5C7.46699 20.5 7.04199 20.325 6.69199 19.975C6.34199 19.625 6.16699 19.2 6.16699 18.7V6H5.91699C5.70033 6 5.52133 5.929 5.37999 5.787C5.23799 5.64567 5.16699 5.46667 5.16699 5.25C5.16699 5.03333 5.23799 4.85433 5.37999 4.713C5.52133 4.571 5.70033 4.5 5.91699 4.5H9.66699C9.66699 4.25 9.75433 4.04167 9.92899 3.875C10.1043 3.70833 10.317 3.625 10.567 3.625H14.767C15.017 3.625 15.2297 3.70833 15.405 3.875C15.5797 4.04167 15.667 4.25 15.667 4.5H19.417C19.6337 4.5 19.813 4.571 19.955 4.713C20.0963 4.85433 20.167 5.03333 20.167 5.25C20.167 5.46667 20.0963 5.64567 19.955 5.787C19.813 5.929 19.6337 6 19.417 6H19.167V18.7C19.167 19.2 18.992 19.625 18.642 19.975C18.292 20.325 17.867 20.5 17.367 20.5H7.96699ZM7.66699 6V18.7C7.66699 18.7833 7.69633 18.8543 7.75499 18.913C7.81299 18.971 7.88366 19 7.96699 19H17.367C17.4503 19 17.5213 18.971 17.58 18.913C17.638 18.8543 17.667 18.7833 17.667 18.7V6H7.66699ZM10.067 16.25C10.067 16.4667 10.138 16.646 10.28 16.788C10.4213 16.9293 10.6003 17 10.817 17C11.0337 17 11.213 16.9293 11.355 16.788C11.4963 16.646 11.567 16.4667 11.567 16.25V8.75C11.567 8.53333 11.4963 8.354 11.355 8.212C11.213 8.07067 11.0337 8 10.817 8C10.6003 8 10.4213 8.07067 10.28 8.212C10.138 8.354 10.067 8.53333 10.067 8.75V16.25ZM13.767 16.25C13.767 16.4667 13.8377 16.646 13.979 16.788C14.121 16.9293 14.3003 17 14.517 17C14.7337 17 14.913 16.9293 15.055 16.788C15.1963 16.646 15.267 16.4667 15.267 16.25V8.75C15.267 8.53333 15.1963 8.354 15.055 8.212C14.913 8.07067 14.7337 8 14.517 8C14.3003 8 14.121 8.07067 13.979 8.212C13.8377 8.354 13.767 8.53333 13.767 8.75V16.25ZM7.66699 6V18.7C7.66699 18.7833 7.69633 18.8543 7.75499 18.913C7.81299 18.971 7.88366 19 7.96699 19H7.66699V6Z" fill="#BA1A1A"/>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default SvgTrash;
|
|
23
|
+
/* tslint:enable */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import useModal from '../../../framework/hooks/useModal';
|
|
4
|
+
|
|
5
|
+
import Modal from './Modal';
|
|
6
|
+
|
|
7
|
+
const ModalComponent = () => {
|
|
8
|
+
const { isVisible, toggleModal } = useModal();
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<button onClick={toggleModal}>
|
|
12
|
+
open modal
|
|
13
|
+
</button>
|
|
14
|
+
<Modal isVisible={isVisible} toggleModal={toggleModal} name='TEST_MODAL' />
|
|
15
|
+
</>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
storiesOf('_Common_UI', module)
|
|
21
|
+
.add('Modal', () => <ModalComponent />)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled } from '@mui/system';
|
|
2
|
+
|
|
3
|
+
export const BaseModalWrapper = styled('div')({
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
top: '50%',
|
|
6
|
+
left: '50%',
|
|
7
|
+
transform: 'translate(-50%, -50%)',
|
|
8
|
+
width: 400,
|
|
9
|
+
backgroundColor: '#fff',
|
|
10
|
+
boxShadow: 24,
|
|
11
|
+
padding: 20
|
|
12
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Modal from '@mui/material/Modal';
|
|
3
|
+
import ModalsConfig from './ModalsConfig';
|
|
4
|
+
import { BaseModalWrapper } from './Modal.styled';
|
|
5
|
+
|
|
6
|
+
interface IBasicModal {
|
|
7
|
+
isVisible: boolean;
|
|
8
|
+
toggleModal: () => void;
|
|
9
|
+
name: string;
|
|
10
|
+
modalProps?: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const BasicModal = ({ isVisible, toggleModal, name, modalProps }: IBasicModal) => {
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Modal open={isVisible} onClose={toggleModal}>
|
|
17
|
+
<BaseModalWrapper>
|
|
18
|
+
{ModalsConfig[name](modalProps)}
|
|
19
|
+
</BaseModalWrapper>
|
|
20
|
+
</Modal>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default BasicModal;
|
|
@@ -8,47 +8,47 @@ const superAdmin = true;
|
|
|
8
8
|
const userMenuItems = [
|
|
9
9
|
{
|
|
10
10
|
icon: 'dashboardIcon',
|
|
11
|
-
|
|
11
|
+
label: 'Dashboard'
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
icon: 'userProfileIcon',
|
|
15
|
-
|
|
15
|
+
label: 'Profile'
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
icon: 'addressIcon',
|
|
19
|
-
|
|
19
|
+
label: 'Address'
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
icon: 'myVehiclesIcon',
|
|
23
|
-
|
|
23
|
+
label: 'My Vehicles'
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
icon: 'savedSearchsIcon',
|
|
27
|
-
|
|
27
|
+
label: 'Saved searchs'
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
icon: 'favoritesIcon',
|
|
31
|
-
|
|
31
|
+
label: 'Favorites',
|
|
32
32
|
amount: 0
|
|
33
33
|
},
|
|
34
34
|
!superAdmin && {
|
|
35
35
|
icon: 'dealersIcon',
|
|
36
|
-
|
|
36
|
+
label: 'Dealers',
|
|
37
37
|
amount: 1234,
|
|
38
38
|
divider: true
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
icon: 'imageSettingsIcon',
|
|
42
|
-
|
|
42
|
+
label: 'Image Settings'
|
|
43
43
|
},
|
|
44
44
|
!superAdmin && {
|
|
45
45
|
icon: 'supportCallbackIcon',
|
|
46
|
-
|
|
46
|
+
label: 'Support & Call back',
|
|
47
47
|
divider: true
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
icon: 'logoutIcon',
|
|
51
|
-
|
|
51
|
+
label: 'Logout'
|
|
52
52
|
},
|
|
53
53
|
|
|
54
54
|
];
|
|
@@ -65,12 +65,11 @@ const MaterialMenu = ({ menuItems, headerComponent, onChange, isLang, containerC
|
|
|
65
65
|
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
|
66
66
|
>
|
|
67
67
|
{menuItems.map((listItemProps: any, index: number) => {
|
|
68
|
-
const { value } = listItemProps;
|
|
69
68
|
return !!listItemProps &&
|
|
70
69
|
<ListItem
|
|
71
70
|
key={listItemProps.text}
|
|
72
71
|
selected={index === selectedIndex}
|
|
73
|
-
onClick={() => onHandleChange(value, index)}
|
|
72
|
+
onClick={() => onHandleChange(listItemProps.value, index)}
|
|
74
73
|
isSelect={isSelect}
|
|
75
74
|
Link={Link}
|
|
76
75
|
{ ...listItemProps }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const useModal = () => {
|
|
4
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
5
|
+
|
|
6
|
+
const toggleModal = () => {
|
|
7
|
+
setIsVisible(!isVisible);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return { isVisible, toggleModal };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default useModal;
|