@bytebrand/fe-ui-core 4.2.8 → 4.2.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.2.8",
3
+ "version": "4.2.9",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -260,7 +260,7 @@ class VehiclePrice extends React.Component<IVehiclePriceSectionProps> {
260
260
 
261
261
  const offerBtnVariantCondition = vehicleComponentName === 'recently' ||
262
262
  vehicleComponentName === 'landing' ||
263
- vehicleComponentName === 'main' ? 'outlined' : 'contained'
263
+ vehicleComponentName === 'main' ? 'outlined' : 'contained';
264
264
  return (
265
265
  <section className={vehiclePriceSectionClassName}>
266
266
  {vehicleComponentName === 'favorite' && showCompareCheckboxes && (
@@ -16,7 +16,7 @@ interface IMaterialTooltip {
16
16
 
17
17
  const LightTooltip = styled(({ className, ...props }: TooltipProps) => (
18
18
  <Tooltip {...props} classes={{ popper: className }} />
19
- ))((props) => ({
19
+ ))(props => ({
20
20
  zIndex: props.zindex ? props.zindex : 9996,
21
21
  [`& .${tooltipClasses.tooltip}`]: {
22
22
  backgroundColor: '#fff',
@@ -42,7 +42,7 @@ const MaterialTooltip = ({ text, placement, className, disabled, zindex }: IMate
42
42
  return (
43
43
  <ClickAwayListener onClickAway={() => setIsOpen(false)}>
44
44
  <LightTooltip
45
- open={isOpen}
45
+ open={isOpen}
46
46
  onMouseOver={() => setIsOpen(true)}
47
47
  onMouseLeave={() => setIsOpen(false)}
48
48
  placement={placement}
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { storiesOf } from '@storybook/react';
4
4
  import MaterialMenu from './MaterialMenu';
5
5
 
6
- const superAdmin = true;
6
+ const superAdmin = false;
7
7
 
8
8
  const userMenuItems = [
9
9
  {
@@ -35,7 +35,24 @@ const userMenuItems = [
35
35
  icon: 'dealersIcon',
36
36
  label: 'Dealers',
37
37
  amount: 1234,
38
- divider: true
38
+ divider: true,
39
+ nestedItems: [
40
+ {
41
+ icon: 'supportCallbackIcon',
42
+ label: 'Support & Call back',
43
+ divider: true,
44
+ },
45
+ {
46
+ icon: 'supportCallbackIcon',
47
+ label: 'Support & Call back',
48
+ divider: true,
49
+ },
50
+ {
51
+ icon: 'supportCallbackIcon',
52
+ label: 'Support & Call back',
53
+ divider: true,
54
+ }
55
+ ]
39
56
  },
40
57
  {
41
58
  icon: 'imageSettingsIcon',
@@ -5,6 +5,7 @@ import { ThemeProvider } from '@mui/material/styles';
5
5
  import { Theme, FlexContainer, HeaderComponent } from './MaterialMenu.styled';
6
6
  import IconSVG from '../IconSVG/IconSVG';
7
7
  import { isMobileOnly } from 'react-device-detect';
8
+ import NestedMenu from './NestedMenu';
8
9
 
9
10
  export interface ILoggedInUserInfoProps {
10
11
  profileName?: string;
@@ -72,6 +73,11 @@ const MaterialMenu = ({ menuItems, headerComponent, onChange, isLang, containerC
72
73
  anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
73
74
  >
74
75
  {menuItems.map((listItemProps: any, index: number) => {
76
+ if (!!listItemProps && listItemProps.nestedItems && listItemProps.nestedItems.length > 0) {
77
+ return (
78
+ <NestedMenu {...listItemProps} />
79
+ );
80
+ }
75
81
  return !!listItemProps &&
76
82
  <ListItem
77
83
  key={index}
@@ -0,0 +1,58 @@
1
+ import React, { useState } from 'react';
2
+ import Menu from '@mui/material/Menu';
3
+ import ListItem from './MaterialMenuItem';
4
+ import MenuItem from '@mui/material/MenuItem';
5
+ import ListItemText from '@mui/material/ListItemText';
6
+ import IconSVG from '../IconSVG/IconSVG';
7
+ import ListItemIcon from '@mui/material/ListItemIcon';
8
+ import { AmountBlock } from './MaterialMenu.styled';
9
+
10
+ export interface INestedMenuProps {
11
+ nestedItems: any;
12
+ label: string;
13
+ icon?: string;
14
+ amount?: number;
15
+ }
16
+
17
+ const NestedMenu = ({ nestedItems, label, icon, amount }: INestedMenuProps) => {
18
+ const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
19
+ const open = Boolean(anchorEl);
20
+ const handleClick = (event: React.MouseEvent<HTMLElement>) => {
21
+ setAnchorEl(event.currentTarget);
22
+ };
23
+ const handleClose = () => {
24
+ setAnchorEl(null);
25
+ };
26
+ return (
27
+ <>
28
+ <MenuItem onClick={handleClick}>
29
+ {icon && <ListItemIcon><IconSVG customDimensions name={icon} /></ListItemIcon>}
30
+ <ListItemText>
31
+ {label}
32
+ </ListItemText>
33
+ {(amount || amount === 0) && <AmountBlock>{amount}</AmountBlock>}
34
+ </MenuItem>
35
+ <Menu
36
+ anchorEl={anchorEl}
37
+ open={open}
38
+ onClose={handleClose}
39
+ PaperProps={{
40
+ elevation: 0
41
+ }}
42
+ transformOrigin={{ horizontal: 'right', vertical: 'center' }}
43
+ anchorOrigin={{ horizontal: 'left', vertical: 'center' }}
44
+ >
45
+ {nestedItems.map((nestedListItemProps: any, nestedIndex: number) => {
46
+ return (
47
+ <ListItem
48
+ key={nestedIndex}
49
+ { ...nestedListItemProps }
50
+ />
51
+ );
52
+ })}
53
+ </Menu>
54
+ </>
55
+ );
56
+ };
57
+
58
+ export default NestedMenu;