orcs-design-system 3.2.48 → 3.3.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/es/components/Avatar/Avatar.stories.js +29 -0
- package/es/components/Avatar/index.js +19 -18
- package/es/components/Box/index.js +2 -2
- package/es/components/Flex/index.js +2 -2
- package/es/components/FloatingPanels/FloatingPanels.styles.js +1 -1
- package/es/components/Header/Header.stories.js +61 -164
- package/es/components/Header/Header.styles.js +116 -0
- package/es/components/Header/UserMenu.js +142 -0
- package/es/components/Header/index.js +59 -822
- package/es/components/HeaderComplex/HeaderComplex.stories.js +186 -0
- package/es/components/HeaderComplex/index.js +928 -0
- package/es/components/SideNav/NavItem.js +1 -1
- package/es/components/SideNav/index.js +3 -3
- package/es/components/Tag/Tag.stories.js +16 -5
- package/es/components/Tag/index.js +5 -5
- package/es/components.test.js +1 -0
- package/es/index.js +1 -0
- package/es/systemThemeCollapsed.js +2 -1
- package/es/systemtheme.js +2 -1
- package/package.json +1 -1
|
@@ -110,6 +110,30 @@ export const large = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
|
110
110
|
})]
|
|
111
111
|
});
|
|
112
112
|
large.storyName = "Large";
|
|
113
|
+
export const customSize = () => /*#__PURE__*/_jsxs(Flex, {
|
|
114
|
+
gap: "r",
|
|
115
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
116
|
+
image: "https://api.dicebear.com/7.x/personas/svg?seed=aydos",
|
|
117
|
+
imageAlt: "Avatar for Ayden Lundgre",
|
|
118
|
+
customSize: "28px"
|
|
119
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
120
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
121
|
+
imageAlt: "Avatar for Innovation Lab",
|
|
122
|
+
customSize: "28px",
|
|
123
|
+
shape: "square"
|
|
124
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
125
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
126
|
+
imageAlt: "Avatar for Innovation Lab",
|
|
127
|
+
customSize: "28px",
|
|
128
|
+
shape: "hexagon"
|
|
129
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
130
|
+
image: "https://images.unsplash.com/photo-1627398242454-45a1465c2479?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2148&q=80",
|
|
131
|
+
imageAlt: "Avatar for Tag",
|
|
132
|
+
customSize: "28px",
|
|
133
|
+
shape: "tag"
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
large.storyName = "customSize";
|
|
113
137
|
export const titleLevel = () => /*#__PURE__*/_jsx(Spacer, {
|
|
114
138
|
my: 4,
|
|
115
139
|
children: /*#__PURE__*/_jsx(Avatar, {
|
|
@@ -379,6 +403,11 @@ large.__docgenInfo = {
|
|
|
379
403
|
"methods": [],
|
|
380
404
|
"displayName": "large"
|
|
381
405
|
};
|
|
406
|
+
customSize.__docgenInfo = {
|
|
407
|
+
"description": "",
|
|
408
|
+
"methods": [],
|
|
409
|
+
"displayName": "customSize"
|
|
410
|
+
};
|
|
382
411
|
titleLevel.__docgenInfo = {
|
|
383
412
|
"description": "",
|
|
384
413
|
"methods": [],
|
|
@@ -63,8 +63,8 @@ const Image = styled("img").withConfig({
|
|
|
63
63
|
displayName: "Avatar__Image",
|
|
64
64
|
componentId: "sc-1wtet2j-2"
|
|
65
65
|
})(props => css({
|
|
66
|
-
width: themeGet("appScale.avatarDefault")(props),
|
|
67
|
-
height: themeGet("appScale.avatarDefault")(props),
|
|
66
|
+
width: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
67
|
+
height: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
68
68
|
flex: "0 0 auto",
|
|
69
69
|
backgroundColor: themeGet("colors.greyLighter")(props),
|
|
70
70
|
border: "0",
|
|
@@ -102,12 +102,12 @@ const Shape = styled("div").withConfig({
|
|
|
102
102
|
displayName: "Avatar__Shape",
|
|
103
103
|
componentId: "sc-1wtet2j-3"
|
|
104
104
|
})(props => css({
|
|
105
|
-
width: themeGet("appScale.avatarDefault")(props),
|
|
106
|
-
height: themeGet("appScale.avatarDefault")(props),
|
|
105
|
+
width: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
106
|
+
height: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
107
107
|
fontWeight: themeGet("fontWeights.2")(props),
|
|
108
108
|
flex: "0 0 auto",
|
|
109
|
-
|
|
110
|
-
color:
|
|
109
|
+
background: `linear-gradient(135deg, ${themeGet("colors.primaryLightest")(props)}, ${themeGet("colors.primaryLight")(props)})`,
|
|
110
|
+
color: themeGet("colors.white")(props),
|
|
111
111
|
border: "0",
|
|
112
112
|
display: "flex",
|
|
113
113
|
borderRadius: "50%",
|
|
@@ -266,7 +266,7 @@ const Avatar = _ref2 => {
|
|
|
266
266
|
shape,
|
|
267
267
|
localTime,
|
|
268
268
|
uppercase = true,
|
|
269
|
-
|
|
269
|
+
customSize,
|
|
270
270
|
...props
|
|
271
271
|
} = _ref2;
|
|
272
272
|
const hasTitle = !!title;
|
|
@@ -287,13 +287,14 @@ const Avatar = _ref2 => {
|
|
|
287
287
|
src: image,
|
|
288
288
|
sizing: sizing,
|
|
289
289
|
shape: shape,
|
|
290
|
-
alt: alt
|
|
290
|
+
alt: alt,
|
|
291
|
+
customSize: customSize
|
|
291
292
|
}) : /*#__PURE__*/_jsx(Shape, {
|
|
292
293
|
shape: shape,
|
|
293
294
|
sizing: sizing,
|
|
295
|
+
customSize: customSize,
|
|
294
296
|
type: type,
|
|
295
297
|
className: type == "inverted" ? "inverted" : "",
|
|
296
|
-
whiteInitials: whiteInitials,
|
|
297
298
|
uppercase: uppercase,
|
|
298
299
|
children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
|
|
299
300
|
icon: ["fas", "users"]
|
|
@@ -342,6 +343,8 @@ const Avatar = _ref2 => {
|
|
|
342
343
|
Avatar.propTypes = {
|
|
343
344
|
/** Changes the sizing of the Avatar component */
|
|
344
345
|
sizing: PropTypes.oneOf(["small", "large", "default"]),
|
|
346
|
+
/* If specifying custom sizing, provide a string with the size in pixels */
|
|
347
|
+
customSize: PropTypes.string,
|
|
345
348
|
/** Changes the shape of the Avatar component */
|
|
346
349
|
shape: PropTypes.oneOf(["square", "hexagon", "tag", "default"]),
|
|
347
350
|
/** Specifies the inverted type for dark backgrounds */
|
|
@@ -362,8 +365,6 @@ Avatar.propTypes = {
|
|
|
362
365
|
initials: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
363
366
|
/** Specifies custom content for avatar subtitle */
|
|
364
367
|
subtitleContent: PropTypes.oneOfType([PropTypes.element, PropTypes.node]),
|
|
365
|
-
/** Turns white initials on for custom `Circle` backgrounds */
|
|
366
|
-
whiteInitials: PropTypes.bool,
|
|
367
368
|
/** Specifies whether to use uppercase for initials */
|
|
368
369
|
uppercase: PropTypes.bool,
|
|
369
370
|
/** Specifies title / name as just plain text, or an element like a hyperlink or react router link */
|
|
@@ -440,6 +441,13 @@ Avatar.__docgenInfo = {
|
|
|
440
441
|
},
|
|
441
442
|
"required": false
|
|
442
443
|
},
|
|
444
|
+
"customSize": {
|
|
445
|
+
"description": "",
|
|
446
|
+
"type": {
|
|
447
|
+
"name": "string"
|
|
448
|
+
},
|
|
449
|
+
"required": false
|
|
450
|
+
},
|
|
443
451
|
"shape": {
|
|
444
452
|
"description": "Changes the shape of the Avatar component",
|
|
445
453
|
"type": {
|
|
@@ -513,13 +521,6 @@ Avatar.__docgenInfo = {
|
|
|
513
521
|
},
|
|
514
522
|
"required": false
|
|
515
523
|
},
|
|
516
|
-
"whiteInitials": {
|
|
517
|
-
"description": "Turns white initials on for custom `Circle` backgrounds",
|
|
518
|
-
"type": {
|
|
519
|
-
"name": "bool"
|
|
520
|
-
},
|
|
521
|
-
"required": false
|
|
522
|
-
},
|
|
523
524
|
"title": {
|
|
524
525
|
"description": "Specifies title / name as just plain text, or an element like a hyperlink or react router link",
|
|
525
526
|
"type": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import styled, { ThemeProvider } from "styled-components";
|
|
3
|
-
import { space, layout, color, border, variant, compose } from "styled-system";
|
|
3
|
+
import { space, layout, flexbox, color, border, variant, compose } from "styled-system";
|
|
4
4
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
5
5
|
import { css } from "@styled-system/css";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
7
|
import { themeGet } from "@styled-system/theme-get";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const boxStyles = compose(space, layout, color, border);
|
|
9
|
+
const boxStyles = compose(space, layout, flexbox, color, border);
|
|
10
10
|
const BoxWrapper = styled("div").withConfig({
|
|
11
11
|
shouldForwardProp,
|
|
12
12
|
displayName: "Box__BoxWrapper",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import styled, { ThemeProvider } from "styled-components";
|
|
4
|
-
import { space, layout, flexbox, compose } from "styled-system";
|
|
4
|
+
import { space, layout, flexbox, color, border, compose } from "styled-system";
|
|
5
5
|
import { css } from "@styled-system/css";
|
|
6
6
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
7
7
|
import styledPropTypes from "@styled-system/prop-types";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const FlexStyles = compose(space, layout, flexbox);
|
|
9
|
+
const FlexStyles = compose(space, layout, flexbox, color, border);
|
|
10
10
|
const FlexWrapper = styled("div").withConfig({
|
|
11
11
|
shouldForwardProp,
|
|
12
12
|
displayName: "Flex__FlexWrapper",
|
|
@@ -53,7 +53,7 @@ export const PanelWrapper = styled.div.withConfig({
|
|
|
53
53
|
export const PanelHeader = styled.button.withConfig({
|
|
54
54
|
displayName: "FloatingPanelsstyles__PanelHeader",
|
|
55
55
|
componentId: "sc-1by914f-2"
|
|
56
|
-
})(["font-family:", ";box-shadow:0 0 4px rgba(0,0,0,0.1);color:", ";width:100%;margin-left:-13px;margin-top:-46px;border-radius:", ";appearance:none;background-color:white;display:flex;align-items:center;justify-content:space-between;padding:12px 12px 12px 12px;height:46px;position:
|
|
56
|
+
})(["font-family:", ";box-shadow:0 0 4px rgba(0,0,0,0.1);color:", ";width:100%;margin-left:-13px;margin-top:-46px;border-radius:", ";appearance:none;background-color:white;display:flex;align-items:center;justify-content:space-between;padding:12px 12px 12px 12px;height:46px;position:absolute;width:300px;border-bottom:", ";border:solid 1px ", ";z-index:1;cursor:pointer;user-select:none;transition:padding 0.3s ease-in-out;&:focus{outline:none;}"], themeGet("fonts.main"), themeGet("colors.greyDarkest"), _ref10 => {
|
|
57
57
|
let {
|
|
58
58
|
isExpanded
|
|
59
59
|
} = _ref10;
|
|
@@ -1,76 +1,71 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import
|
|
3
|
-
import Header from "../Header";
|
|
4
|
-
import StyledLink from "../StyledLink";
|
|
5
|
-
import Icon from "../Icon";
|
|
6
|
-
import { Small } from "../Typography";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Header from ".";
|
|
7
3
|
import TextInput from "../TextInput";
|
|
8
|
-
import Select from "../Select";
|
|
9
4
|
import Box from "../Box";
|
|
5
|
+
import Flex from "../Flex";
|
|
6
|
+
import { Small } from "../Typography";
|
|
7
|
+
import Toggle from "../Toggle";
|
|
8
|
+
import Divider from "../Divider";
|
|
9
|
+
import Icon from "../Icon";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
export default {
|
|
12
12
|
title: "Components/Header",
|
|
13
|
+
component: Header,
|
|
13
14
|
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
14
|
-
height: "
|
|
15
|
+
height: "350px",
|
|
16
|
+
bg: "greyLightest",
|
|
17
|
+
p: "r",
|
|
15
18
|
children: storyFn()
|
|
16
|
-
})],
|
|
17
|
-
component: Header
|
|
18
|
-
};
|
|
19
|
-
export const defaultHeader = () => /*#__PURE__*/_jsxs(Header, {
|
|
20
|
-
appName: `App Name`,
|
|
21
|
-
userName: `Michael`,
|
|
22
|
-
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
23
|
-
clientInfo: `Tenant: ci2153 Workspace: 20k-v5 [lb5ctx] UI_Version: 8c315c2 [4412] Backend_Version: dabc261 [3578]`,
|
|
24
|
-
logoutFunction: action("clicked-logout"),
|
|
25
|
-
sideMenuContent: /*#__PURE__*/_jsxs(StyledLink, {
|
|
26
|
-
href: "#",
|
|
27
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
|
28
|
-
icon: ["fas", "cog"],
|
|
29
|
-
mr: "s"
|
|
30
|
-
}), "Settings"]
|
|
31
|
-
}),
|
|
32
|
-
navToggleId: "defaultHeader",
|
|
33
|
-
children: [/*#__PURE__*/_jsx(StyledLink, {
|
|
34
|
-
href: "#",
|
|
35
|
-
white: true,
|
|
36
|
-
bold: true,
|
|
37
|
-
active: true,
|
|
38
|
-
children: "Summary"
|
|
39
|
-
}), /*#__PURE__*/_jsx(StyledLink, {
|
|
40
|
-
href: "#",
|
|
41
|
-
white: true,
|
|
42
|
-
bold: true,
|
|
43
|
-
children: "Find"
|
|
44
|
-
}), /*#__PURE__*/_jsx(StyledLink, {
|
|
45
|
-
href: "#",
|
|
46
|
-
white: true,
|
|
47
|
-
bold: true,
|
|
48
|
-
children: "Visualisation"
|
|
49
19
|
})]
|
|
20
|
+
};
|
|
21
|
+
const dummyLogo = /*#__PURE__*/_jsx("svg", {
|
|
22
|
+
width: "67",
|
|
23
|
+
height: "41",
|
|
24
|
+
viewBox: "0 0 67 41",
|
|
25
|
+
fill: "none",
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
28
|
+
d: "M45.0353 4.66312C45.8331 3.77669 46.7195 3.04539 47.6281 2.46921C49.2236 1.47198 50.9079 0.940125 52.6364 0.940125V15.411C51.3732 11.0232 48.6475 7.25591 45.0353 4.66312ZM66.5533 40.9401H15.2957C6.87461 40.9401 0.0712891 34.1146 0.0712891 25.7157C0.0712891 17.6714 6.3206 11.0675 14.232 10.5135V0.940125C16.0048 0.940125 17.7555 1.44982 19.3954 2.46921C20.304 3.02323 21.1904 3.75453 21.9882 4.59663C25.2458 2.31409 29.1904 0.984446 33.4674 0.984446C33.4674 10.2254 30.1433 20.9734 19.3289 20.9955H33.3566C32.9577 19.2005 31.3178 17.8709 29.3677 17.8487H37.5228C35.5727 17.8487 33.9328 19.2005 33.5339 21.0177H46.6087C49.2236 21.0177 51.8164 21.5274 54.2541 22.5468C56.6696 23.544 58.8857 25.0288 60.725 26.8681C62.5865 28.7296 64.0491 30.9235 65.0464 33.339C66.0436 35.7324 66.5533 38.3252 66.5533 40.9401ZM22.8525 10.7795C23.1849 11.6437 24.0713 12.6188 25.3123 13.3279C26.5533 14.0371 27.8386 14.3252 28.7472 14.1922C28.4148 13.3279 27.5284 12.3529 26.2874 11.6437C25.0464 10.9346 23.761 10.6465 22.8525 10.7795ZM41.5117 13.3279C40.2707 14.0371 38.9854 14.3252 38.0768 14.1922C38.4092 13.3279 39.2957 12.3529 40.5367 11.6437C41.7777 10.9346 43.063 10.6465 43.9716 10.7795C43.6613 11.6437 42.7527 12.6188 41.5117 13.3279Z",
|
|
29
|
+
fill: "#283841"
|
|
30
|
+
})
|
|
50
31
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
const UserMenuContent = () => {
|
|
33
|
+
const [checked, setChecked] = React.useState(false);
|
|
34
|
+
const handleToggleChange = () => {
|
|
35
|
+
setChecked(!checked);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
38
|
+
children: [/*#__PURE__*/_jsx(Small, {
|
|
39
|
+
fontWeight: "600",
|
|
40
|
+
fontSize: "0",
|
|
41
|
+
children: "Compact theme"
|
|
42
|
+
}), /*#__PURE__*/_jsx(Toggle, {
|
|
43
|
+
id: "compactTheme",
|
|
44
|
+
label: checked ? "On" : "Off",
|
|
45
|
+
small: true,
|
|
46
|
+
onChange: handleToggleChange
|
|
47
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
48
|
+
light: true
|
|
49
|
+
}), /*#__PURE__*/_jsxs(Flex, {
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
gap: "s",
|
|
52
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
53
|
+
icon: ["fas", "sign-out-alt"]
|
|
54
|
+
}), /*#__PURE__*/_jsx(Small, {
|
|
55
|
+
fontWeight: "600",
|
|
56
|
+
children: "Logout"
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export const defaultHeader = () => /*#__PURE__*/_jsx(Header, {
|
|
62
|
+
appName: "Powercorp directory",
|
|
63
|
+
logo: dummyLogo,
|
|
64
|
+
userName: "Michael Jenkins (michael.jenkins@powercorp.com)",
|
|
65
|
+
avatarSource: "https://api.dicebear.com/7.x/personas/svg?seed=mike",
|
|
66
|
+
avatarAlt: "Avatar for Michael",
|
|
67
|
+
avatarInitials: "MJ",
|
|
68
|
+
currentWorkspace: "Org Design Workspace",
|
|
74
69
|
searchComponent: /*#__PURE__*/_jsx(TextInput, {
|
|
75
70
|
fullWidth: true,
|
|
76
71
|
id: "search",
|
|
@@ -78,109 +73,11 @@ export const headerWithSearchAndLinks = () => /*#__PURE__*/_jsxs(Header, {
|
|
|
78
73
|
placeholder: "Search for...",
|
|
79
74
|
iconRight: ["fas", "search"]
|
|
80
75
|
}, "search"),
|
|
81
|
-
|
|
82
|
-
children: [/*#__PURE__*/_jsx(StyledLink, {
|
|
83
|
-
href: "#",
|
|
84
|
-
white: true,
|
|
85
|
-
bold: true,
|
|
86
|
-
children: "Summary"
|
|
87
|
-
}), /*#__PURE__*/_jsx(StyledLink, {
|
|
88
|
-
href: "#",
|
|
89
|
-
white: true,
|
|
90
|
-
bold: true,
|
|
91
|
-
children: "Teams"
|
|
92
|
-
}), /*#__PURE__*/_jsx(StyledLink, {
|
|
93
|
-
href: "#",
|
|
94
|
-
white: true,
|
|
95
|
-
bold: true,
|
|
96
|
-
children: "People"
|
|
97
|
-
}), /*#__PURE__*/_jsx(StyledLink, {
|
|
98
|
-
href: "#",
|
|
99
|
-
white: true,
|
|
100
|
-
bold: true,
|
|
101
|
-
children: "Reports"
|
|
102
|
-
})]
|
|
76
|
+
userMenuContent: /*#__PURE__*/_jsx(UserMenuContent, {})
|
|
103
77
|
});
|
|
104
|
-
|
|
105
|
-
export const headerWithWorkspaceSwitching = () => {
|
|
106
|
-
const options = [{
|
|
107
|
-
label: "Workspace A"
|
|
108
|
-
}, {
|
|
109
|
-
label: "Workspace B"
|
|
110
|
-
}];
|
|
111
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
112
|
-
const [selected, setSelected] = useState([{
|
|
113
|
-
label: "Workspace A"
|
|
114
|
-
}]);
|
|
115
|
-
const onChange = value => {
|
|
116
|
-
setSelected(value);
|
|
117
|
-
};
|
|
118
|
-
const currentWorkspace = "Workspace A";
|
|
119
|
-
const select = /*#__PURE__*/_jsx(Select, {
|
|
120
|
-
id: "WorkspaceSelect",
|
|
121
|
-
"data-testid": "select-workspace-dropdown",
|
|
122
|
-
placeholder: "Select a workspace",
|
|
123
|
-
options: options,
|
|
124
|
-
value: selected,
|
|
125
|
-
onChange: onChange,
|
|
126
|
-
height: "30px",
|
|
127
|
-
padding: "0 8px",
|
|
128
|
-
inverted: true
|
|
129
|
-
});
|
|
130
|
-
const internalAppLinks = /*#__PURE__*/_jsxs(_Fragment, {
|
|
131
|
-
children: [/*#__PURE__*/_jsxs(StyledLink, {
|
|
132
|
-
href: "#",
|
|
133
|
-
target: "_blank",
|
|
134
|
-
children: ["App 1 Name", /*#__PURE__*/_jsx(Small, {
|
|
135
|
-
children: "This is a description of other app in suite"
|
|
136
|
-
})]
|
|
137
|
-
}), /*#__PURE__*/_jsxs(StyledLink, {
|
|
138
|
-
href: "#",
|
|
139
|
-
target: "_blank",
|
|
140
|
-
children: ["App 2 Name", /*#__PURE__*/_jsx(Small, {
|
|
141
|
-
children: "This is a description of other app in suite"
|
|
142
|
-
})]
|
|
143
|
-
})]
|
|
144
|
-
});
|
|
145
|
-
const externalAppLinks = /*#__PURE__*/_jsxs(StyledLink, {
|
|
146
|
-
href: "#",
|
|
147
|
-
target: "_blank",
|
|
148
|
-
children: ["External App Name", /*#__PURE__*/_jsx(Small, {
|
|
149
|
-
children: "This is a description of external 3rd party app"
|
|
150
|
-
})]
|
|
151
|
-
});
|
|
152
|
-
return /*#__PURE__*/_jsx(Header, {
|
|
153
|
-
appName: `App Name`,
|
|
154
|
-
currentWorkspace: currentWorkspace,
|
|
155
|
-
userName: `Michael`,
|
|
156
|
-
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
157
|
-
clientInfo: `Tenant: ci2153 Workspace: 20k-v5 [lb5ctx] UI_Version: 8c315c2 [4412] Backend_Version: dabc261 [3578]`,
|
|
158
|
-
logoutFunction: action("clicked-logout"),
|
|
159
|
-
workspaceSwitcherContent: select,
|
|
160
|
-
navToggleId: "headerWithWorkspaceSwitching",
|
|
161
|
-
appSwitcher: true,
|
|
162
|
-
internalAppSwitcherContent: internalAppLinks,
|
|
163
|
-
externalAppSwitcherContent: externalAppLinks
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
headerWithWorkspaceSwitching.storyName = "Header with workspace switching";
|
|
78
|
+
defaultHeader.storyName = "Default Header";
|
|
167
79
|
defaultHeader.__docgenInfo = {
|
|
168
80
|
"description": "",
|
|
169
81
|
"methods": [],
|
|
170
82
|
"displayName": "defaultHeader"
|
|
171
|
-
};
|
|
172
|
-
headerWithSearch.__docgenInfo = {
|
|
173
|
-
"description": "",
|
|
174
|
-
"methods": [],
|
|
175
|
-
"displayName": "headerWithSearch"
|
|
176
|
-
};
|
|
177
|
-
headerWithSearchAndLinks.__docgenInfo = {
|
|
178
|
-
"description": "",
|
|
179
|
-
"methods": [],
|
|
180
|
-
"displayName": "headerWithSearchAndLinks"
|
|
181
|
-
};
|
|
182
|
-
headerWithWorkspaceSwitching.__docgenInfo = {
|
|
183
|
-
"description": "",
|
|
184
|
-
"methods": [],
|
|
185
|
-
"displayName": "headerWithWorkspaceSwitching"
|
|
186
83
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { space, layout } from "styled-system";
|
|
3
|
+
import css from "@styled-system/css";
|
|
4
|
+
import { themeGet } from "@styled-system/theme-get";
|
|
5
|
+
import Box from "../Box";
|
|
6
|
+
export const Bar = styled("header").attrs(props => ({
|
|
7
|
+
"data-testid": props.dataTestId
|
|
8
|
+
})).withConfig({
|
|
9
|
+
displayName: "Headerstyles__Bar",
|
|
10
|
+
componentId: "sc-xs8ba0-0"
|
|
11
|
+
})(props => ({
|
|
12
|
+
height: themeGet("appScale.navBarSize")(props)
|
|
13
|
+
}), css({
|
|
14
|
+
width: "100%",
|
|
15
|
+
zIndex: 12,
|
|
16
|
+
position: "sticky",
|
|
17
|
+
top: "0",
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
bg: "transparent",
|
|
21
|
+
gap: "r",
|
|
22
|
+
p: "r"
|
|
23
|
+
}), space);
|
|
24
|
+
export const AppName = styled("div").withConfig({
|
|
25
|
+
displayName: "Headerstyles__AppName",
|
|
26
|
+
componentId: "sc-xs8ba0-1"
|
|
27
|
+
})(props => css({
|
|
28
|
+
background: themeGet("colors.white")(props),
|
|
29
|
+
width: "fit-content",
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: ["0", "0", "0", "s"],
|
|
33
|
+
px: "s",
|
|
34
|
+
height: "38px",
|
|
35
|
+
borderRadius: themeGet("radii.2")(props),
|
|
36
|
+
border: `1px solid ${themeGet("colors.greyLight")(props)}`,
|
|
37
|
+
boxShadow: themeGet("shadows.boxDefault")(props),
|
|
38
|
+
fontSize: themeGet("fontSizes.1")(props),
|
|
39
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
40
|
+
color: themeGet("colors.greyDarkest")(props),
|
|
41
|
+
img: {
|
|
42
|
+
height: "22px",
|
|
43
|
+
width: "auto"
|
|
44
|
+
},
|
|
45
|
+
svg: {
|
|
46
|
+
height: "22px",
|
|
47
|
+
width: "auto"
|
|
48
|
+
},
|
|
49
|
+
a: {
|
|
50
|
+
fontSize: themeGet("fontSizes.1")(props),
|
|
51
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
52
|
+
color: themeGet("colors.greyDarkest")(props)
|
|
53
|
+
}
|
|
54
|
+
}), space);
|
|
55
|
+
export const SearchContainer = styled("div").withConfig({
|
|
56
|
+
displayName: "Headerstyles__SearchContainer",
|
|
57
|
+
componentId: "sc-xs8ba0-2"
|
|
58
|
+
})(props => css({
|
|
59
|
+
maxWidth: "600px",
|
|
60
|
+
flex: "1 1 auto",
|
|
61
|
+
borderRadius: themeGet("radii.2")(props),
|
|
62
|
+
boxShadow: themeGet("shadows.boxDefault")(props)
|
|
63
|
+
}), space, layout);
|
|
64
|
+
export const UserMenuToggle = styled("button").withConfig({
|
|
65
|
+
displayName: "Headerstyles__UserMenuToggle",
|
|
66
|
+
componentId: "sc-xs8ba0-3"
|
|
67
|
+
})(props => css({
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
gap: "xs",
|
|
72
|
+
padding: "0",
|
|
73
|
+
cursor: "pointer",
|
|
74
|
+
border: "none",
|
|
75
|
+
appearance: "none",
|
|
76
|
+
bg: "transparent",
|
|
77
|
+
color: themeGet("colors.greyDark")(props),
|
|
78
|
+
fontSize: themeGet("fontSizes.1")(props),
|
|
79
|
+
fontWeight: themeGet("fontWeights.2")(props),
|
|
80
|
+
"svg path": {
|
|
81
|
+
transition: "fill 300ms ease-in-out"
|
|
82
|
+
},
|
|
83
|
+
"&:focus, &:hover": {
|
|
84
|
+
outline: "none",
|
|
85
|
+
"svg path": {
|
|
86
|
+
fill: themeGet("colors.primary")(props)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
export const AvatarBorder = styled(Box).withConfig({
|
|
91
|
+
displayName: "Headerstyles__AvatarBorder",
|
|
92
|
+
componentId: "sc-xs8ba0-4"
|
|
93
|
+
})(css({
|
|
94
|
+
background: "linear-gradient(0deg, rgba(155,81,224,1) 0%, rgba(0,145,234,1) 100%)"
|
|
95
|
+
}));
|
|
96
|
+
export const UserMenuContainer = styled(Box).withConfig({
|
|
97
|
+
displayName: "Headerstyles__UserMenuContainer",
|
|
98
|
+
componentId: "sc-xs8ba0-5"
|
|
99
|
+
})(props => css({
|
|
100
|
+
borderRadius: `19px ${themeGet("radii.2")(props)} ${themeGet("radii.2")(props)} 19px`,
|
|
101
|
+
position: "relative"
|
|
102
|
+
}));
|
|
103
|
+
export const UserMenuContent = styled(Box).withConfig({
|
|
104
|
+
displayName: "Headerstyles__UserMenuContent",
|
|
105
|
+
componentId: "sc-xs8ba0-6"
|
|
106
|
+
})(props => css({
|
|
107
|
+
position: "absolute",
|
|
108
|
+
gap: "s",
|
|
109
|
+
top: "calc(100% + 8px)",
|
|
110
|
+
right: "0",
|
|
111
|
+
zIndex: themeGet("zIndices.2")(props),
|
|
112
|
+
opacity: props.isOpen ? 1 : 0,
|
|
113
|
+
transform: props.isOpen ? "translateY(0)" : "translateY(-10px)",
|
|
114
|
+
pointerEvents: props.isOpen ? "all" : "none",
|
|
115
|
+
transition: "opacity 0.3s ease, transform 0.3s ease"
|
|
116
|
+
}));
|