@dtdot/lego 0.19.2 → 0.19.3
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/build/components/MinimalMenu/MinimalMenu.component.d.ts +1 -1
- package/build/components/MinimalMenu/_MinimalMenuItem.component.d.ts +5 -4
- package/build/components/MinimalMenu/_MinimalMenuItem.component.js +3 -3
- package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.d.ts +5 -4
- package/build/components/MinimalMenu/desktop/_DesktopMinimalMenuItem.component.js +2 -2
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.d.ts +5 -4
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export interface MinimalMenuProps {
|
|
|
4
4
|
}
|
|
5
5
|
declare const MinimalMenu: {
|
|
6
6
|
({ children }: MinimalMenuProps): JSX.Element;
|
|
7
|
-
Item: ({ icon, active, onClick }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
|
|
7
|
+
Item: ({ icon, active, onClick, "data-cy": dataCy }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
|
|
8
8
|
Page: ({ children }: import("./_MinimalMenuPage.component").MinimalMenuPageProps) => JSX.Element;
|
|
9
9
|
};
|
|
10
10
|
export default MinimalMenu;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
export interface MinimalMenuItemProps {
|
|
4
|
-
icon?: IconProp;
|
|
5
|
-
active?: boolean;
|
|
6
|
-
onClick?: () => void;
|
|
4
|
+
'icon'?: IconProp;
|
|
5
|
+
'active'?: boolean;
|
|
6
|
+
'onClick'?: () => void;
|
|
7
|
+
'data-cy'?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const MinimalMenuItem: ({ icon, active, onClick }: MinimalMenuItemProps) => JSX.Element;
|
|
9
|
+
declare const MinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MinimalMenuItemProps) => JSX.Element;
|
|
9
10
|
export default MinimalMenuItem;
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { useIsScreenSize } from '../../responsive/responsive';
|
|
3
3
|
import MobileMinimalMenuItem from './mobile/_MobileMinimalMenuItem.component';
|
|
4
4
|
import DesktopMinimalMenuItem from './desktop/_DesktopMinimalMenuItem.component';
|
|
5
|
-
const MinimalMenuItem = ({ icon, active, onClick }) => {
|
|
5
|
+
const MinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
|
|
6
6
|
const isMobile = useIsScreenSize('mobile');
|
|
7
7
|
if (isMobile) {
|
|
8
|
-
return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick });
|
|
8
|
+
return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-cy": dataCy });
|
|
9
9
|
}
|
|
10
|
-
return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick });
|
|
10
|
+
return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-cy": dataCy });
|
|
11
11
|
};
|
|
12
12
|
export default MinimalMenuItem;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
export interface DesktopMinimalMenuItemProps {
|
|
4
|
-
icon?: IconProp;
|
|
5
|
-
active?: boolean;
|
|
6
|
-
onClick?: () => void;
|
|
4
|
+
'icon'?: IconProp;
|
|
5
|
+
'active'?: boolean;
|
|
6
|
+
'onClick'?: () => void;
|
|
7
|
+
'data-cy'?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const DesktopMinimalMenuItem: ({ icon, active, onClick }: DesktopMinimalMenuItemProps) => JSX.Element;
|
|
9
|
+
declare const DesktopMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: DesktopMinimalMenuItemProps) => JSX.Element;
|
|
9
10
|
export default DesktopMinimalMenuItem;
|
|
@@ -27,14 +27,14 @@ const iconContainerVariants = {
|
|
|
27
27
|
active: { x: 2 },
|
|
28
28
|
hoverActive: { x: 2 },
|
|
29
29
|
};
|
|
30
|
-
const DesktopMinimalMenuItem = ({ icon, active, onClick }) => {
|
|
30
|
+
const DesktopMinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
|
|
31
31
|
const theme = useTheme();
|
|
32
32
|
const barVariants = useMemo(() => ({
|
|
33
33
|
hover: { opacity: 1, backgroundColor: theme.colours.defaultBorder, width: 4 },
|
|
34
34
|
active: { opacity: 1, backgroundColor: theme.colours.primary.main, width: 4 },
|
|
35
35
|
hoverActive: { opacity: 1, backgroundColor: theme.colours.primary.main, width: 4 },
|
|
36
36
|
}), [theme]);
|
|
37
|
-
return (React.createElement(ItemContainer, { whileHover: active ? 'hoverActive' : 'hover', animate: active ? 'active' : undefined, onClick: onClick, "data-cy": 'menu-item' },
|
|
37
|
+
return (React.createElement(ItemContainer, { whileHover: active ? 'hoverActive' : 'hover', animate: active ? 'active' : undefined, onClick: onClick, "data-cy": dataCy || 'menu-item' },
|
|
38
38
|
React.createElement(MenuIconBar, { style: { backgroundColor: theme.colours.cardBackground, opacity: 0 }, variants: barVariants, transition: { type: 'spring', duration: 0.3 } }),
|
|
39
39
|
icon && (React.createElement(motion.div, { variants: iconContainerVariants },
|
|
40
40
|
React.createElement(FontAwesomeIcon, { icon: icon })))));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
export interface MobileMinimalMenuItemProps {
|
|
4
|
-
icon?: IconProp;
|
|
5
|
-
active?: boolean;
|
|
6
|
-
onClick?: () => void;
|
|
4
|
+
'icon'?: IconProp;
|
|
5
|
+
'active'?: boolean;
|
|
6
|
+
'onClick'?: () => void;
|
|
7
|
+
'data-cy'?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const MobileMinimalMenuItem: ({ icon, active, onClick }: MobileMinimalMenuItemProps) => JSX.Element;
|
|
9
|
+
declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-cy": dataCy }: MobileMinimalMenuItemProps) => JSX.Element;
|
|
9
10
|
export default MobileMinimalMenuItem;
|
|
@@ -20,7 +20,7 @@ const ItemContainer = styled.div `
|
|
|
20
20
|
const iconContainerVariants = {
|
|
21
21
|
active: { fontSize: '28px', y: -8 },
|
|
22
22
|
};
|
|
23
|
-
const MobileMinimalMenuItem = ({ icon, active, onClick }) => {
|
|
23
|
+
const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-cy': dataCy }) => {
|
|
24
24
|
const { width } = useWindowDimensions();
|
|
25
25
|
const { setBumpX } = useContext(MobileMenuBumpContext);
|
|
26
26
|
const itemRef = useRef(null);
|
|
@@ -36,7 +36,7 @@ const MobileMinimalMenuItem = ({ icon, active, onClick }) => {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}, [active, setBumpX, width]);
|
|
39
|
-
return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-cy": 'menu-item' }, icon && (React.createElement(motion.div, { animate: active ? 'active' : undefined, style: { fontSize: '20px' }, variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
|
|
39
|
+
return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-cy": dataCy || 'menu-item' }, icon && (React.createElement(motion.div, { animate: active ? 'active' : undefined, style: { fontSize: '20px' }, variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
|
|
40
40
|
React.createElement(FontAwesomeIcon, { icon: icon })))));
|
|
41
41
|
};
|
|
42
42
|
export default MobileMinimalMenuItem;
|