@dtdot/lego 2.0.0-30 → 2.0.0-32
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 +2 -1
- package/build/components/MinimalMenu/_MinimalMenuItem.component.js +2 -2
- package/build/components/MinimalMenu/mobile/_MobileMenu.constants.js +1 -1
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuContainer.component.js +5 -25
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.d.ts +2 -1
- package/build/components/MinimalMenu/mobile/_MobileMinimalMenuItem.component.js +18 -24
- package/package.json +1 -1
- package/build/components/MinimalMenu/mobile/_MobileMenuBump.component.d.ts +0 -3
- package/build/components/MinimalMenu/mobile/_MobileMenuBump.component.js +0 -4
- package/build/components/MinimalMenu/mobile/_MobileMenuBump.context.d.ts +0 -6
- package/build/components/MinimalMenu/mobile/_MobileMenuBump.context.js +0 -6
|
@@ -5,7 +5,7 @@ export interface MinimalMenuProps {
|
|
|
5
5
|
declare const MinimalMenu: {
|
|
6
6
|
({ children }: MinimalMenuProps): JSX.Element;
|
|
7
7
|
Header: ({ hiddenMenu, text, rightContent }: import("./_MinimalMenuHeader.component").MinimalMenuHeaderProps) => JSX.Element;
|
|
8
|
-
Item: ({ icon, active, onClick, "data-testid": dataTestId }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
|
|
8
|
+
Item: ({ icon, label, active, onClick, "data-testid": dataTestId }: import("./_MinimalMenuItem.component").MinimalMenuItemProps) => JSX.Element;
|
|
9
9
|
Page: ({ children, hiddenMenu }: import("./_MinimalMenuPage.component").MinimalMenuPageProps) => JSX.Element;
|
|
10
10
|
};
|
|
11
11
|
export default MinimalMenu;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
export interface MinimalMenuItemProps {
|
|
4
4
|
'icon'?: IconProp;
|
|
5
|
+
'label': string;
|
|
5
6
|
'active'?: boolean;
|
|
6
7
|
'onClick'?: () => void;
|
|
7
8
|
'data-testid'?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const MinimalMenuItem: ({ icon, active, onClick, "data-testid": dataTestId }: MinimalMenuItemProps) => JSX.Element;
|
|
10
|
+
declare const MinimalMenuItem: ({ icon, label, active, onClick, "data-testid": dataTestId }: MinimalMenuItemProps) => JSX.Element;
|
|
10
11
|
export default MinimalMenuItem;
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { useIsScreenSize } from '../../responsive/responsive';
|
|
3
3
|
import DesktopMinimalMenuItem from './desktop/_DesktopMinimalMenuItem.component';
|
|
4
4
|
import MobileMinimalMenuItem from './mobile/_MobileMinimalMenuItem.component';
|
|
5
|
-
const MinimalMenuItem = ({ icon, active, onClick, 'data-testid': dataTestId }) => {
|
|
5
|
+
const MinimalMenuItem = ({ icon, label, active, onClick, 'data-testid': dataTestId }) => {
|
|
6
6
|
const isMobile = useIsScreenSize('mobile');
|
|
7
7
|
if (isMobile) {
|
|
8
|
-
return React.createElement(MobileMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-testid": dataTestId });
|
|
8
|
+
return (React.createElement(MobileMinimalMenuItem, { icon: icon, label: label, active: active, onClick: onClick, "data-testid": dataTestId }));
|
|
9
9
|
}
|
|
10
10
|
return React.createElement(DesktopMinimalMenuItem, { icon: icon, active: active, onClick: onClick, "data-testid": dataTestId });
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const mobileMenuDefaultTransition = { type: 'spring', duration: 0.
|
|
1
|
+
export const mobileMenuDefaultTransition = { type: 'spring', duration: 0.1, bounce: 0 };
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { motion } from 'framer-motion';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
|
-
import { mobileMenuDefaultTransition } from './_MobileMenu.constants';
|
|
5
|
-
import MobileMenuBump from './_MobileMenuBump.component';
|
|
6
|
-
import MobileMenuBumpContext from './_MobileMenuBump.context';
|
|
7
3
|
const MobileMinimalMenuOuter = styled.div `
|
|
8
4
|
position: fixed;
|
|
9
5
|
bottom: 0;
|
|
10
6
|
left: 0;
|
|
11
7
|
|
|
12
8
|
width: 100%;
|
|
13
|
-
height:
|
|
9
|
+
height: 56px;
|
|
14
10
|
z-index: 10;
|
|
15
11
|
|
|
16
12
|
display: flex;
|
|
17
13
|
justify-content: space-evenly;
|
|
14
|
+
align-items: center;
|
|
18
15
|
|
|
19
|
-
background-color: ${(props) => props.theme.colours.
|
|
20
|
-
`;
|
|
21
|
-
const AnimatedMenuBumpContainer = styled(motion.div) `
|
|
22
|
-
position: fixed;
|
|
23
|
-
bottom: 46px;
|
|
24
|
-
left: 0;
|
|
25
|
-
|
|
26
|
-
width: 86px;
|
|
27
|
-
height: 24px;
|
|
28
|
-
|
|
29
|
-
svg {
|
|
30
|
-
fill: ${(props) => props.theme.colours.cardBackground};
|
|
31
|
-
}
|
|
16
|
+
background-color: ${(props) => props.theme.colours.background};
|
|
32
17
|
`;
|
|
33
18
|
const MobileMinimalMenuContainer = ({ children }) => {
|
|
34
|
-
|
|
35
|
-
return (React.createElement(MobileMenuBumpContext.Provider, { value: { setBumpX } },
|
|
36
|
-
React.createElement(MobileMinimalMenuOuter, null,
|
|
37
|
-
React.createElement(AnimatedMenuBumpContainer, { animate: { opacity: bumpX ? 1 : 0, x: bumpX ? bumpX - 86 / 2 : undefined, y: bumpX ? 0 : 100 }, transition: mobileMenuDefaultTransition },
|
|
38
|
-
React.createElement(MobileMenuBump, null)),
|
|
39
|
-
children)));
|
|
19
|
+
return React.createElement(MobileMinimalMenuOuter, null, children);
|
|
40
20
|
};
|
|
41
21
|
export default MobileMinimalMenuContainer;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
export interface MobileMinimalMenuItemProps {
|
|
4
4
|
'icon'?: IconProp;
|
|
5
|
+
'label': string;
|
|
5
6
|
'active'?: boolean;
|
|
6
7
|
'onClick'?: () => void;
|
|
7
8
|
'data-testid'?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const MobileMinimalMenuItem: ({ icon, active, onClick, "data-testid": dataTestId }: MobileMinimalMenuItemProps) => JSX.Element;
|
|
10
|
+
declare const MobileMinimalMenuItem: ({ icon, label, active, onClick, "data-testid": dataTestId, }: MobileMinimalMenuItemProps) => JSX.Element;
|
|
10
11
|
export default MobileMinimalMenuItem;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
import useWindowDimensions from '../../../hooks/useWindowDimensions';
|
|
6
5
|
import { mobileMenuDefaultTransition } from './_MobileMenu.constants';
|
|
7
|
-
import
|
|
6
|
+
import darkTheme from '../../../theme/dark.theme';
|
|
8
7
|
const ItemContainer = styled.div `
|
|
9
8
|
position: relative;
|
|
10
9
|
|
|
11
|
-
color: ${(props) => props.theme.colours.defaultFont};
|
|
12
10
|
cursor: pointer;
|
|
13
11
|
|
|
14
12
|
width: 48px;
|
|
@@ -17,26 +15,22 @@ const ItemContainer = styled.div `
|
|
|
17
15
|
justify-content: center;
|
|
18
16
|
align-items: center;
|
|
19
17
|
`;
|
|
18
|
+
const MotionDivContainer = styled(motion.div) `
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
|
|
23
|
+
padding-top: 3px;
|
|
24
|
+
`;
|
|
25
|
+
const TextDiv = styled.div `
|
|
26
|
+
font-size: 11px;
|
|
27
|
+
padding-top: 6px;
|
|
28
|
+
`;
|
|
20
29
|
const iconContainerVariants = {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
const MobileMinimalMenuItem = ({ icon, active, onClick, 'data-testid': dataTestId }) => {
|
|
24
|
-
const { width } = useWindowDimensions();
|
|
25
|
-
const { setBumpX } = useContext(MobileMenuBumpContext);
|
|
26
|
-
const itemRef = useRef(null);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (active && width > 0) {
|
|
29
|
-
const left = itemRef.current?.offsetLeft;
|
|
30
|
-
const center = left ? left + 48 / 2 : undefined;
|
|
31
|
-
setBumpX(center);
|
|
32
|
-
}
|
|
33
|
-
return () => {
|
|
34
|
-
if (active) {
|
|
35
|
-
setBumpX(undefined);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}, [active, setBumpX, width]);
|
|
39
|
-
return (React.createElement(ItemContainer, { onClick: onClick, ref: itemRef, "data-testid": dataTestId || 'menu-item' }, icon && (React.createElement(motion.div, { animate: active ? 'active' : undefined, style: { fontSize: '20px' }, variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
|
|
40
|
-
React.createElement(FontAwesomeIcon, { icon: icon })))));
|
|
30
|
+
base: { color: darkTheme.colours.defaultFont },
|
|
31
|
+
active: { color: darkTheme.colours.primary.hover },
|
|
41
32
|
};
|
|
33
|
+
const MobileMinimalMenuItem = ({ icon, label, active, onClick, 'data-testid': dataTestId, }) => (React.createElement(ItemContainer, { onClick: onClick, "data-testid": dataTestId || 'menu-item' }, icon && (React.createElement(MotionDivContainer, { animate: active ? 'active' : 'base', variants: iconContainerVariants, transition: mobileMenuDefaultTransition },
|
|
34
|
+
React.createElement(FontAwesomeIcon, { icon: icon }),
|
|
35
|
+
React.createElement(TextDiv, null, label)))));
|
|
42
36
|
export default MobileMinimalMenuItem;
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const MobileMenuBump = () => (React.createElement("svg", { width: '86', height: '24', viewBox: '0 0 86 24', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
|
|
3
|
-
React.createElement("path", { d: 'M86 19C86 26.6902 62.4543 22.5 41.5 22.5C22 22 0 25.1902 0 19C9 18.1902 9.91176 16.75 17.5 10.5C25.0882 4.25 31.6176 0.0597534 43 0.0597534C54.3824 0.0597534 61.4118 4.75 69 11C76.5882 17.25 79.5 18.1902 86 19Z' })));
|
|
4
|
-
export default MobileMenuBump;
|