@dtdot/lego 0.14.9 → 0.16.0
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/ActionMessage/ActionMessage.stories.js +1 -2
- package/build/components/InlineCard/InlineCard.component.d.ts +7 -1
- package/build/components/InlineCard/InlineCard.component.js +46 -11
- package/build/components/InlineCard/InlineCard.stories.d.ts +1 -0
- package/build/components/InlineCard/InlineCard.stories.js +11 -0
- package/build/components/InlineCard/InlineCardGroup.component.d.ts +2 -1
- package/build/components/InlineCard/InlineCardGroup.component.js +20 -1
- package/build/components/Menu/Menu.component.d.ts +3 -3
- package/build/components/Menu/Menu.component.js +63 -5
- package/build/components/Menu/Menu.stories.js +3 -6
- package/build/components/Menu/_MenuContent.component.js +12 -1
- package/build/components/Menu/_MenuHeading.component.d.ts +4 -1
- package/build/components/Menu/_MenuHeading.component.js +20 -2
- package/build/components/Notifications/Notifications.stories.js +3 -6
- package/build/components/PageHeader/PageHeader.component.d.ts +3 -2
- package/build/components/PageHeader/PageHeader.component.js +10 -4
- package/build/components/PageHeader/PageHeader.stories.d.ts +1 -0
- package/build/components/PageHeader/PageHeader.stories.js +5 -1
- package/build/components/Swimlane/Swimlane.stories.d.ts +1 -0
- package/build/components/Swimlane/Swimlane.stories.js +60 -13
- package/package.json +1 -1
|
@@ -6,8 +6,7 @@ export const Standard = () => (React.createElement(React.Fragment, null,
|
|
|
6
6
|
console.log('testing');
|
|
7
7
|
} })));
|
|
8
8
|
export const InPanel = () => (React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement(Menu,
|
|
10
|
-
React.createElement(Menu.Heading, null, "Action Message")),
|
|
9
|
+
React.createElement(Menu, { heading: 'Action Message' }),
|
|
11
10
|
React.createElement(Menu.Content, null,
|
|
12
11
|
React.createElement(Menu.Panel, { panelSize: 'sm' },
|
|
13
12
|
React.createElement(ActionMessage, { header: 'Create an asset', info: "It looks like you don't have any assets, create one to get started", action: 'Create', onAction: () => {
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import { Status } from '../../theme/theme.types';
|
|
2
4
|
export declare type InlineCardSize = 'fill' | 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
+
export declare type DragVariant = Status;
|
|
3
6
|
export interface InlineCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
7
|
children: React.ReactNode;
|
|
5
8
|
size?: InlineCardSize;
|
|
9
|
+
gestureLeftIcon?: IconProp;
|
|
10
|
+
gestureLeftVariant?: DragVariant;
|
|
11
|
+
onGestureLeft?: () => void;
|
|
6
12
|
}
|
|
7
13
|
declare const InlineCard: {
|
|
8
|
-
({ children, size, onClick }: InlineCardProps): JSX.Element;
|
|
14
|
+
({ children, size, onClick, gestureLeftIcon, gestureLeftVariant, onGestureLeft, }: InlineCardProps): JSX.Element;
|
|
9
15
|
Media: ({ children }: import("./_InlineCardMedia.component").InlineCardMediaProps) => JSX.Element;
|
|
10
16
|
Content: ({ children, center }: import("./_InlineCardContent.component").InlineCardContentProps) => JSX.Element;
|
|
11
17
|
Meta: ({ children }: import("./_InlineCardMeta.component").InlineCardMetaProps) => JSX.Element;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { motion, useMotionValue, useTransform } from 'framer-motion';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
3
4
|
import { responsive } from '../..';
|
|
5
|
+
import getThemeStatusColour from '../../theme/helpers/getThemeStatusColour';
|
|
4
6
|
import InlineCardContent from './_InlineCardContent.component';
|
|
5
7
|
import InlineCardMedia from './_InlineCardMedia.component';
|
|
6
8
|
import InlineCardMeta from './_InlineCardMeta.component';
|
|
7
|
-
|
|
9
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
10
|
+
const CardWrapper = styled.div `
|
|
11
|
+
position: relative;
|
|
8
12
|
height: 64px;
|
|
9
|
-
width: 100%;
|
|
10
|
-
display: flex;
|
|
11
|
-
|
|
12
|
-
cursor: ${(props) => (props.usePointer ? 'pointer' : '')};
|
|
13
|
-
|
|
14
|
-
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
15
|
-
box-shadow: ${(props) => props.theme.shadows.small};
|
|
16
13
|
|
|
17
14
|
${(props) => {
|
|
18
15
|
switch (props.size) {
|
|
@@ -52,8 +49,46 @@ const CardOuter = styled.div `
|
|
|
52
49
|
}
|
|
53
50
|
}}
|
|
54
51
|
`;
|
|
55
|
-
const
|
|
56
|
-
|
|
52
|
+
const CardOuter = styled(motion.div) `
|
|
53
|
+
height: 64px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
display: flex;
|
|
56
|
+
|
|
57
|
+
cursor: ${(props) => (props.usePointer ? 'pointer' : '')};
|
|
58
|
+
|
|
59
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
60
|
+
box-shadow: ${(props) => props.theme.shadows.small};
|
|
61
|
+
`;
|
|
62
|
+
const CardActionBackground = styled(motion.div) `
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: flex-end;
|
|
69
|
+
align-items: center;
|
|
70
|
+
padding: 8px;
|
|
71
|
+
padding-right: 16px;
|
|
72
|
+
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
`;
|
|
77
|
+
const InlineCard = ({ children, size, onClick, gestureLeftIcon, gestureLeftVariant, onGestureLeft, }) => {
|
|
78
|
+
const theme = useTheme();
|
|
79
|
+
const x = useMotionValue(0);
|
|
80
|
+
const xInput = [-70, 0];
|
|
81
|
+
const gestureLeftTheme = getThemeStatusColour(gestureLeftVariant || 'info', theme);
|
|
82
|
+
const opacity = useTransform(x, xInput, ['1', '0']);
|
|
83
|
+
const handleDragEnd = (e, panInfo) => {
|
|
84
|
+
// approx xInputMin * 3
|
|
85
|
+
if (panInfo.offset.x < -180 && onGestureLeft) {
|
|
86
|
+
onGestureLeft();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return (React.createElement(CardWrapper, { size: size },
|
|
90
|
+
React.createElement(CardActionBackground, { style: { opacity, backgroundColor: gestureLeftTheme.main } }, gestureLeftIcon && (React.createElement(FontAwesomeIcon, { style: { fontSize: '20px', color: gestureLeftTheme.contrast }, icon: gestureLeftIcon }))),
|
|
91
|
+
React.createElement(CardOuter, { drag: onGestureLeft ? 'x' : undefined, onDragEnd: handleDragEnd, style: { x }, dragConstraints: { left: 0, right: 0 }, usePointer: !!onClick, onClick: onClick }, children)));
|
|
57
92
|
};
|
|
58
93
|
InlineCard.Media = InlineCardMedia;
|
|
59
94
|
InlineCard.Content = InlineCardContent;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta } from '@storybook/react/types-6-0';
|
|
3
3
|
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const WithDrag: () => JSX.Element;
|
|
4
5
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
5
6
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { faCheckCircle, faExclamationTriangle, faInfoCircle, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
2
3
|
import { Badge, InlineCard, InlineCardGroup } from '../..';
|
|
3
4
|
export const Standard = () => (React.createElement(InlineCardGroup, null,
|
|
4
5
|
React.createElement(InlineCard, null,
|
|
@@ -13,6 +14,16 @@ export const Standard = () => (React.createElement(InlineCardGroup, null,
|
|
|
13
14
|
React.createElement(InlineCard.Content, null, "Clickable card"),
|
|
14
15
|
React.createElement(InlineCard.Meta, null,
|
|
15
16
|
React.createElement(Badge, { variant: 'info' }, "Clickable")))));
|
|
17
|
+
export const WithDrag = () => (React.createElement("div", { style: { maxWidth: '400px' } },
|
|
18
|
+
React.createElement(InlineCardGroup, null,
|
|
19
|
+
React.createElement(InlineCard, { onGestureLeft: () => console.log('Gesture left triggered'), gestureLeftIcon: faCheckCircle, gestureLeftVariant: 'success' },
|
|
20
|
+
React.createElement(InlineCard.Content, null, "A success gesture")),
|
|
21
|
+
React.createElement(InlineCard, { onGestureLeft: () => console.log('Gesture left triggered'), gestureLeftIcon: faInfoCircle, gestureLeftVariant: 'info' },
|
|
22
|
+
React.createElement(InlineCard.Content, null, "A info gesture")),
|
|
23
|
+
React.createElement(InlineCard, { onGestureLeft: () => console.log('Gesture left triggered'), gestureLeftIcon: faExclamationTriangle, gestureLeftVariant: 'warn' },
|
|
24
|
+
React.createElement(InlineCard.Content, null, "A warning gesture")),
|
|
25
|
+
React.createElement(InlineCard, { onGestureLeft: () => console.log('Gesture left triggered'), gestureLeftIcon: faTimes, gestureLeftVariant: 'danger' },
|
|
26
|
+
React.createElement(InlineCard.Content, null, "A danger gesture")))));
|
|
16
27
|
export default {
|
|
17
28
|
title: 'Components/InlineCard',
|
|
18
29
|
component: InlineCard,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface InlineCardGroupProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
wrap?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const InlineCardGroup: ({ children }: InlineCardGroupProps) => JSX.Element;
|
|
6
|
+
declare const InlineCardGroup: ({ children, wrap }: InlineCardGroupProps) => JSX.Element;
|
|
6
7
|
export default InlineCardGroup;
|
|
@@ -13,5 +13,24 @@ const InlineGroup = styled.div `
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
|
-
const
|
|
16
|
+
const WrappedInlineGroup = styled.div `
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
|
|
20
|
+
& > * {
|
|
21
|
+
margin-bottom: 4px;
|
|
22
|
+
margin-top: 4px;
|
|
23
|
+
margin-right: 8px;
|
|
24
|
+
|
|
25
|
+
&:last-child {
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const InlineCardGroup = ({ children, wrap }) => {
|
|
31
|
+
if (wrap) {
|
|
32
|
+
return React.createElement(WrappedInlineGroup, null, children);
|
|
33
|
+
}
|
|
34
|
+
return React.createElement(InlineGroup, null, children);
|
|
35
|
+
};
|
|
17
36
|
export default InlineCardGroup;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MenuProps {
|
|
3
|
-
children
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
heading: string;
|
|
4
5
|
}
|
|
5
6
|
declare const Menu: {
|
|
6
|
-
({ children }: MenuProps): JSX.Element;
|
|
7
|
+
({ children, heading }: MenuProps): JSX.Element;
|
|
7
8
|
Page: ({ children, scrollable }: import("./_MenuPage.component").MenuPageProps) => JSX.Element;
|
|
8
|
-
Heading: ({ children }: import("./_MenuHeading.component").MenuHeadingProps) => JSX.Element;
|
|
9
9
|
Item: ({ children, icon, active, onClick }: import("./_MenuItem.component").MenuItemProps) => JSX.Element;
|
|
10
10
|
Content: ({ children }: import("./_MenuContent.component").MenuContentProps) => JSX.Element;
|
|
11
11
|
Panel: ({ children, scrollable, panelSize }: import("./_MenuPanel.component").MenuPanelProps) => JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
2
|
+
import React, { useState } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
4
|
+
import responsive from '../../responsive/responsive';
|
|
3
5
|
import MenuContent from './_MenuContent.component';
|
|
4
6
|
import MenuHeading from './_MenuHeading.component';
|
|
5
7
|
import MenuItem from './_MenuItem.component';
|
|
6
8
|
import MenuPage from './_MenuPage.component';
|
|
7
9
|
import MenuPanel from './_MenuPanel.component';
|
|
8
|
-
const
|
|
10
|
+
const MenuDesktop = styled.div `
|
|
9
11
|
position: fixed;
|
|
10
12
|
top: 0;
|
|
11
13
|
left: 0;
|
|
@@ -14,12 +16,68 @@ const MenuOuter = styled.div `
|
|
|
14
16
|
width: 250px;
|
|
15
17
|
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
16
18
|
padding: 8px 0;
|
|
19
|
+
|
|
20
|
+
${responsive.useStylesFor('tablet').andSmaller(`
|
|
21
|
+
display: none;
|
|
22
|
+
`)}
|
|
23
|
+
`;
|
|
24
|
+
const MenuMobile = styled.div `
|
|
25
|
+
position: fixed;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
|
|
29
|
+
height: 64px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
padding: 8px 0;
|
|
32
|
+
|
|
33
|
+
${responsive.useStylesFor('desktop').andLarger(`
|
|
34
|
+
display: none;
|
|
35
|
+
`)}
|
|
36
|
+
`;
|
|
37
|
+
const MobileMenuNavContainer = styled(motion.div) `
|
|
38
|
+
position: fixed;
|
|
39
|
+
top: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
z-index: 1000;
|
|
42
|
+
height: 100vh;
|
|
43
|
+
width: 250px;
|
|
44
|
+
|
|
45
|
+
padding: 8px 0;
|
|
46
|
+
|
|
47
|
+
cursor: default;
|
|
48
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
17
49
|
`;
|
|
18
|
-
const
|
|
19
|
-
|
|
50
|
+
const MenuShadow = styled(motion.div) `
|
|
51
|
+
position: fixed;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
width: 100vw;
|
|
55
|
+
height: 100vh;
|
|
56
|
+
z-index: 999;
|
|
57
|
+
opacity: 0.7;
|
|
58
|
+
|
|
59
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
60
|
+
`;
|
|
61
|
+
const AnimatedMenuShadow = ({ onClick }) => (React.createElement(MenuShadow, { onClick: onClick, key: 'mobile-menu-shadow', initial: { opacity: 0 }, animate: { opacity: 0.7 }, exit: { opacity: 0 }, transition: { type: 'spring', bounce: 0, duration: 0.6 } }));
|
|
62
|
+
const MobileMenuNav = ({ children }) => {
|
|
63
|
+
return (React.createElement(MobileMenuNavContainer, { key: 'mobile-menu-nav', initial: { x: -300 }, animate: { x: 0 }, exit: { x: -300 }, transition: { type: 'spring', bounce: 0, duration: 0.6 } }, children));
|
|
64
|
+
};
|
|
65
|
+
const Menu = ({ children, heading }) => {
|
|
66
|
+
const [open, setOpen] = useState(false);
|
|
67
|
+
return (React.createElement(React.Fragment, null,
|
|
68
|
+
React.createElement(MenuDesktop, null,
|
|
69
|
+
React.createElement(MenuHeading, null, heading),
|
|
70
|
+
children),
|
|
71
|
+
React.createElement(MenuMobile, null,
|
|
72
|
+
React.createElement(MenuHeading, { onOpen: () => setOpen(true) }, heading)),
|
|
73
|
+
React.createElement(AnimatePresence, null, open && (React.createElement(React.Fragment, null,
|
|
74
|
+
React.createElement(MobileMenuNav, null,
|
|
75
|
+
React.createElement(MenuHeading, { isOpen: open, onClose: () => setOpen(false) }, heading),
|
|
76
|
+
children),
|
|
77
|
+
React.createElement(AnimatedMenuShadow, { onClick: () => setOpen(false) }))))));
|
|
20
78
|
};
|
|
21
79
|
Menu.Page = MenuPage;
|
|
22
|
-
Menu.Heading = MenuHeading;
|
|
80
|
+
// Menu.Heading = MenuHeading;
|
|
23
81
|
Menu.Item = MenuItem;
|
|
24
82
|
Menu.Content = MenuContent;
|
|
25
83
|
Menu.Panel = MenuPanel;
|
|
@@ -4,8 +4,7 @@ import { faCalendarAlt, faCogs, faHamburger } from '@fortawesome/free-solid-svg-
|
|
|
4
4
|
export const Standard = () => {
|
|
5
5
|
const [route, setRoute] = useState('/eat');
|
|
6
6
|
return (React.createElement(React.Fragment, null,
|
|
7
|
-
React.createElement(Menu,
|
|
8
|
-
React.createElement(Menu.Heading, null, "Something Tasty"),
|
|
7
|
+
React.createElement(Menu, { heading: 'Something Tasty' },
|
|
9
8
|
React.createElement(Menu.Item, { icon: faHamburger, active: menuHelpers.isActiveItem([/\/eat/g], route), onClick: () => setRoute('/eat') }, "Eat"),
|
|
10
9
|
React.createElement(Menu.Item, { icon: faCalendarAlt, active: menuHelpers.isActiveItem([/\/plan/g], route), onClick: () => setRoute('/plan') }, "Plan"),
|
|
11
10
|
React.createElement(Menu.Item, { icon: faCogs, active: menuHelpers.isActiveItem([/\/manage/g], route), onClick: () => setRoute('/manage') }, "Manage")),
|
|
@@ -24,8 +23,7 @@ export const Standard = () => {
|
|
|
24
23
|
export const WithPanel = () => {
|
|
25
24
|
const [route, setRoute] = useState('/eat');
|
|
26
25
|
return (React.createElement(React.Fragment, null,
|
|
27
|
-
React.createElement(Menu,
|
|
28
|
-
React.createElement(Menu.Heading, null, "Something Tasty"),
|
|
26
|
+
React.createElement(Menu, { heading: 'Something Tasty' },
|
|
29
27
|
React.createElement(Menu.Item, { icon: faHamburger, active: menuHelpers.isActiveItem([/\/eat/g], route), onClick: () => setRoute('/eat') }, "Eat"),
|
|
30
28
|
React.createElement(Menu.Item, { icon: faCalendarAlt, active: menuHelpers.isActiveItem([/\/plan/g], route), onClick: () => setRoute('/plan') }, "Plan"),
|
|
31
29
|
React.createElement(Menu.Item, { icon: faCogs, active: menuHelpers.isActiveItem([/\/manage/g], route), onClick: () => setRoute('/manage') }, "Manage")),
|
|
@@ -52,8 +50,7 @@ export const WithPanel = () => {
|
|
|
52
50
|
export const IndependentScrolling = () => {
|
|
53
51
|
const [route, setRoute] = useState('/eat');
|
|
54
52
|
return (React.createElement(React.Fragment, null,
|
|
55
|
-
React.createElement(Menu,
|
|
56
|
-
React.createElement(Menu.Heading, null, "Something Tasty"),
|
|
53
|
+
React.createElement(Menu, { heading: 'Something Tasty' },
|
|
57
54
|
React.createElement(Menu.Item, { icon: faHamburger, active: menuHelpers.isActiveItem([/\/eat/g], route), onClick: () => setRoute('/eat') }, "Eat"),
|
|
58
55
|
React.createElement(Menu.Item, { icon: faCalendarAlt, active: menuHelpers.isActiveItem([/\/plan/g], route), onClick: () => setRoute('/plan') }, "Plan"),
|
|
59
56
|
React.createElement(Menu.Item, { icon: faCogs, active: menuHelpers.isActiveItem([/\/manage/g], route), onClick: () => setRoute('/manage') }, "Manage")),
|
|
@@ -12,9 +12,20 @@ const MenuContentOuter = styled.div `
|
|
|
12
12
|
|
|
13
13
|
${responsive.useStylesFor('tablet').andSmaller(`
|
|
14
14
|
flex-direction: column;
|
|
15
|
+
margin-left: 0;
|
|
16
|
+
`)}
|
|
17
|
+
`;
|
|
18
|
+
const TopFiller = styled.div `
|
|
19
|
+
height: 64px;
|
|
20
|
+
background-color: ${(props) => props.theme.colours.cardBackground};
|
|
21
|
+
|
|
22
|
+
${responsive.useStylesFor('desktop').andLarger(`
|
|
23
|
+
display: none;
|
|
15
24
|
`)}
|
|
16
25
|
`;
|
|
17
26
|
const MenuContent = ({ children }) => {
|
|
18
|
-
return React.createElement(MenuContentOuter, null,
|
|
27
|
+
return (React.createElement(MenuContentOuter, null,
|
|
28
|
+
React.createElement(TopFiller, null),
|
|
29
|
+
children));
|
|
19
30
|
};
|
|
20
31
|
export default MenuContent;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MenuHeadingProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
onOpen?: () => void;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
isOpen?: boolean;
|
|
4
7
|
}
|
|
5
|
-
declare const MenuHeading: ({ children }: MenuHeadingProps) => JSX.Element;
|
|
8
|
+
declare const MenuHeading: ({ children, onOpen, onClose, isOpen }: MenuHeadingProps) => JSX.Element;
|
|
6
9
|
export default MenuHeading;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { faBars } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import styled from 'styled-components';
|
|
5
|
+
import responsive from '../../responsive/responsive';
|
|
3
6
|
const MenuHeadingDiv = styled.div `
|
|
4
7
|
padding-right: 32px;
|
|
5
8
|
margin-bottom: 16px;
|
|
6
9
|
|
|
7
10
|
width: 100%;
|
|
8
11
|
text-align: center;
|
|
12
|
+
max-width: 450px;
|
|
9
13
|
`;
|
|
10
14
|
const MenuHeadingInner = styled.div `
|
|
11
15
|
background-color: ${(props) => props.theme.colours.primary.main};
|
|
@@ -22,6 +26,20 @@ const MenuHeadingInner = styled.div `
|
|
|
22
26
|
color: ${(props) => props.theme.colours.primary.contrastText};
|
|
23
27
|
font-size: 20px;
|
|
24
28
|
`;
|
|
25
|
-
const
|
|
26
|
-
|
|
29
|
+
const MenuToggle = styled.div `
|
|
30
|
+
margin-right: 16px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
color: ${(props) => props.theme.colours.primary.contrastText};
|
|
33
|
+
fill: ${(props) => props.theme.colours.primary.contrastText};
|
|
34
|
+
|
|
35
|
+
${responsive.useStylesFor('desktop').andLarger(`
|
|
36
|
+
display: none;
|
|
37
|
+
`)}
|
|
38
|
+
`;
|
|
39
|
+
const MenuHeading = ({ children, onOpen, onClose, isOpen }) => (React.createElement(MenuHeadingDiv, null,
|
|
40
|
+
React.createElement(MenuHeadingInner, null,
|
|
41
|
+
isOpen ? (React.createElement(MenuToggle, { onClick: onClose },
|
|
42
|
+
React.createElement(FontAwesomeIcon, { icon: faBars }))) : (React.createElement(MenuToggle, { onClick: onOpen },
|
|
43
|
+
React.createElement(FontAwesomeIcon, { icon: faBars }))),
|
|
44
|
+
children)));
|
|
27
45
|
export default MenuHeading;
|
|
@@ -16,8 +16,7 @@ export const Standard = () => {
|
|
|
16
16
|
];
|
|
17
17
|
return (React.createElement(React.Fragment, null,
|
|
18
18
|
React.createElement(Notifications, { notifications: notifications }),
|
|
19
|
-
React.createElement(Menu,
|
|
20
|
-
React.createElement(Menu.Heading, null, "Something Tasty")),
|
|
19
|
+
React.createElement(Menu, { heading: 'Something Tasty' }),
|
|
21
20
|
React.createElement(Menu.Page, null,
|
|
22
21
|
React.createElement(FocusLayout, null,
|
|
23
22
|
React.createElement(Text, null, "Content...")))));
|
|
@@ -52,8 +51,7 @@ export const Interactive = () => {
|
|
|
52
51
|
};
|
|
53
52
|
return (React.createElement(React.Fragment, null,
|
|
54
53
|
React.createElement(Notifications, { notifications: notifications }),
|
|
55
|
-
React.createElement(Menu,
|
|
56
|
-
React.createElement(Menu.Heading, null, "Something Tasty")),
|
|
54
|
+
React.createElement(Menu, { heading: 'Something Tasty' }),
|
|
57
55
|
React.createElement(Menu.Page, null,
|
|
58
56
|
React.createElement(FocusLayout, null,
|
|
59
57
|
React.createElement(Button, { onClick: () => addNotification(successNotification) }, "Save user"),
|
|
@@ -79,8 +77,7 @@ export const OverModal = () => {
|
|
|
79
77
|
];
|
|
80
78
|
return (React.createElement(React.Fragment, null,
|
|
81
79
|
React.createElement(Notifications, { notifications: notifications }),
|
|
82
|
-
React.createElement(Menu,
|
|
83
|
-
React.createElement(Menu.Heading, null, "Something Tasty")),
|
|
80
|
+
React.createElement(Menu, { heading: 'Something Tasty' }),
|
|
84
81
|
React.createElement(Menu.Page, null,
|
|
85
82
|
React.createElement(Modal, { onClose: () => {
|
|
86
83
|
console.log('close..');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface PageHeaderProps {
|
|
3
3
|
heading: string;
|
|
4
|
+
actions?: React.ReactNode;
|
|
4
5
|
}
|
|
5
|
-
declare const PageHeader: ({ heading }: PageHeaderProps) => JSX.Element;
|
|
6
|
+
declare const PageHeader: ({ heading, actions }: PageHeaderProps) => JSX.Element;
|
|
6
7
|
export default PageHeader;
|
|
@@ -2,11 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Heading } from '../..';
|
|
4
4
|
const HeaderOuter = styled.div `
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
width: calc(100% - 64px);
|
|
10
|
+
margin: 32px;
|
|
11
|
+
min-height: 48px;
|
|
7
12
|
`;
|
|
8
|
-
const PageHeader = ({ heading }) => {
|
|
13
|
+
const PageHeader = ({ heading, actions }) => {
|
|
9
14
|
return (React.createElement(HeaderOuter, null,
|
|
10
|
-
React.createElement(Heading, null, heading)
|
|
15
|
+
React.createElement(Heading, null, heading),
|
|
16
|
+
React.createElement("div", null, actions)));
|
|
11
17
|
};
|
|
12
18
|
export default PageHeader;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta } from '@storybook/react/types-6-0';
|
|
3
3
|
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const WithActions: () => JSX.Element;
|
|
4
5
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
5
6
|
export default _default;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PageHeader } from '../../';
|
|
2
|
+
import { Button, ButtonGroup, PageHeader } from '../../';
|
|
3
3
|
export const Standard = () => {
|
|
4
4
|
return React.createElement(PageHeader, { heading: 'Frank the Drummer' });
|
|
5
5
|
};
|
|
6
|
+
export const WithActions = () => {
|
|
7
|
+
return (React.createElement(PageHeader, { heading: 'Frank the Drummer', actions: React.createElement(ButtonGroup, null,
|
|
8
|
+
React.createElement(Button, { variant: 'tertiary' }, "Add")) }));
|
|
9
|
+
};
|
|
6
10
|
export default {
|
|
7
11
|
title: 'Components/PageHeader',
|
|
8
12
|
component: PageHeader,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta } from '@storybook/react/types-6-0';
|
|
3
3
|
export declare const Standard: () => JSX.Element;
|
|
4
|
+
export declare const LotsOfCards: () => JSX.Element;
|
|
4
5
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
5
6
|
export default _default;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
2
|
import { InlineCard, Badge, Swimlane, CenteredLayout } from '../../';
|
|
4
|
-
|
|
5
|
-
margin: 8px;
|
|
6
|
-
`;
|
|
3
|
+
import InlineCardGroup from '../InlineCard/InlineCardGroup.component';
|
|
7
4
|
export const Standard = () => {
|
|
8
5
|
return (React.createElement(React.Fragment, null,
|
|
9
6
|
React.createElement(Swimlane, { label: 'Jobs' },
|
|
10
|
-
React.createElement(
|
|
7
|
+
React.createElement(InlineCardGroup, { wrap: true },
|
|
11
8
|
React.createElement(InlineCard, { size: 'xs' },
|
|
12
9
|
React.createElement(InlineCard.Content, { center: true },
|
|
13
10
|
React.createElement(CenteredLayout, null,
|
|
@@ -17,38 +14,88 @@ export const Standard = () => {
|
|
|
17
14
|
React.createElement(InlineCard.Meta, null,
|
|
18
15
|
React.createElement(Badge, { variant: 'success' }, "Full Time"))))),
|
|
19
16
|
React.createElement(Swimlane, { label: 'Properties' },
|
|
20
|
-
React.createElement(
|
|
17
|
+
React.createElement(InlineCardGroup, { wrap: true },
|
|
21
18
|
React.createElement(InlineCard, { size: 'xs' },
|
|
22
19
|
React.createElement(InlineCard.Content, { center: true },
|
|
23
20
|
React.createElement(CenteredLayout, null, "33 Oak Street")),
|
|
24
21
|
React.createElement(InlineCard.Meta, null,
|
|
25
|
-
React.createElement(Badge, { variant: 'success' }, "Primary")))
|
|
26
|
-
React.createElement(CardWrapper, null,
|
|
22
|
+
React.createElement(Badge, { variant: 'success' }, "Primary"))),
|
|
27
23
|
React.createElement(InlineCard, { size: 'xs' },
|
|
28
24
|
React.createElement(InlineCard.Content, { center: true },
|
|
29
25
|
React.createElement(CenteredLayout, null, "402 Main Street")),
|
|
30
26
|
React.createElement(InlineCard.Meta, null,
|
|
31
|
-
React.createElement(Badge, { variant: 'info' }, "Investment")))
|
|
32
|
-
React.createElement(CardWrapper, null,
|
|
27
|
+
React.createElement(Badge, { variant: 'info' }, "Investment"))),
|
|
33
28
|
React.createElement(InlineCard, { size: 'xs' },
|
|
34
29
|
React.createElement(InlineCard.Content, { center: true },
|
|
35
30
|
React.createElement(CenteredLayout, null, "12 Heart Avenue")),
|
|
36
31
|
React.createElement(InlineCard.Meta, null,
|
|
37
32
|
React.createElement(Badge, { variant: 'info' }, "Investment"))))),
|
|
38
33
|
React.createElement(Swimlane, { label: 'Investments' },
|
|
39
|
-
React.createElement(
|
|
34
|
+
React.createElement(InlineCardGroup, { wrap: true },
|
|
40
35
|
React.createElement(InlineCard, { size: 'xs' },
|
|
41
36
|
React.createElement(InlineCard.Content, { center: true },
|
|
42
37
|
React.createElement(CenteredLayout, null, "ASX 200")),
|
|
43
38
|
React.createElement(InlineCard.Meta, null,
|
|
44
|
-
React.createElement(Badge, { variant: 'info' }, "Index Fund")))
|
|
45
|
-
React.createElement(CardWrapper, null,
|
|
39
|
+
React.createElement(Badge, { variant: 'info' }, "Index Fund"))),
|
|
46
40
|
React.createElement(InlineCard, { size: 'xs' },
|
|
47
41
|
React.createElement(InlineCard.Content, { center: true },
|
|
48
42
|
React.createElement(CenteredLayout, null, "AMP Super")),
|
|
49
43
|
React.createElement(InlineCard.Meta, null,
|
|
50
44
|
React.createElement(Badge, { variant: 'info' }, "Super Fund")))))));
|
|
51
45
|
};
|
|
46
|
+
export const LotsOfCards = () => {
|
|
47
|
+
return (React.createElement(React.Fragment, null,
|
|
48
|
+
React.createElement(Swimlane, { label: 'An Example' },
|
|
49
|
+
React.createElement(InlineCardGroup, { wrap: true },
|
|
50
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
51
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
52
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
53
|
+
React.createElement(InlineCard.Meta, null,
|
|
54
|
+
React.createElement(Badge, { variant: 'success' }, "#1"))),
|
|
55
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
56
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
57
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
58
|
+
React.createElement(InlineCard.Meta, null,
|
|
59
|
+
React.createElement(Badge, { variant: 'success' }, "#2"))),
|
|
60
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
61
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
62
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
63
|
+
React.createElement(InlineCard.Meta, null,
|
|
64
|
+
React.createElement(Badge, { variant: 'success' }, "#3"))),
|
|
65
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
66
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
67
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
68
|
+
React.createElement(InlineCard.Meta, null,
|
|
69
|
+
React.createElement(Badge, { variant: 'success' }, "#4"))),
|
|
70
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
71
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
72
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
73
|
+
React.createElement(InlineCard.Meta, null,
|
|
74
|
+
React.createElement(Badge, { variant: 'success' }, "#5"))),
|
|
75
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
76
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
77
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
78
|
+
React.createElement(InlineCard.Meta, null,
|
|
79
|
+
React.createElement(Badge, { variant: 'success' }, "#6"))),
|
|
80
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
81
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
82
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
83
|
+
React.createElement(InlineCard.Meta, null,
|
|
84
|
+
React.createElement(Badge, { variant: 'success' }, "#7"))),
|
|
85
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
86
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
87
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
88
|
+
React.createElement(InlineCard.Meta, null,
|
|
89
|
+
React.createElement(Badge, { variant: 'success' }, "#8"))),
|
|
90
|
+
React.createElement(InlineCard, { size: 'xs' },
|
|
91
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
92
|
+
React.createElement(CenteredLayout, null, "Card")),
|
|
93
|
+
React.createElement(InlineCard.Meta, null,
|
|
94
|
+
React.createElement(Badge, { variant: 'success' }, "#9"))),
|
|
95
|
+
React.createElement(InlineCard, { size: 'xs', onClick: () => console.log('add') },
|
|
96
|
+
React.createElement(InlineCard.Content, { center: true },
|
|
97
|
+
React.createElement(CenteredLayout, null, "Add")))))));
|
|
98
|
+
};
|
|
52
99
|
export default {
|
|
53
100
|
title: 'Components/Swimlane',
|
|
54
101
|
component: Swimlane,
|