@codecademy/brand 3.28.0-alpha.0a9279111d.0 → 3.28.0-alpha.0f5fb538f5.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/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/MarketingBanner.d.ts +2 -1
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/MarketingBanner.js +3 -3
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/NavPanels.d.ts +1 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/NavPanels.js +8 -5
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/consts.d.ts +2 -1
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/consts.js +52 -2
- package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/index.js +5 -4
- package/dist/AppHeader/AppHeaderElements/AppHeaderDietCard/index.js +7 -5
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/AppHeaderSection.test.js +193 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/MobileBackButton.d.ts +25 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/MobileBackButton.js +13 -2
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/MobileNavMenu.js +12 -3
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/NavSection.d.ts +21 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/NavSection.js +206 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/PanelLayout.d.ts +2 -1
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/PanelLayout.js +8 -0
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/elements.d.ts +2 -55
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/elements.js +18 -69
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/index.d.ts +10 -15
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/index.js +28 -89
- package/dist/AppHeaderMobile/AppHeaderSubMenuMobile/index.js +8 -6
- package/dist/GlobalHeader/context.d.ts +3 -1
- package/dist/GlobalHeader/context.js +19 -15
- package/dist/GlobalHeader/index.js +50 -47
- package/dist/GlobalHeader/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/NavTabs.d.ts +0 -20
- package/dist/AppHeader/AppHeaderElements/AppHeaderSection/NavTabs.js +0 -126
|
@@ -16,11 +16,11 @@ export const DropdownPositions = {
|
|
|
16
16
|
free: {
|
|
17
17
|
catalogDropdown: {
|
|
18
18
|
narrow: '-9rem',
|
|
19
|
-
wide: '-
|
|
19
|
+
wide: '-14.5rem'
|
|
20
20
|
},
|
|
21
21
|
resourceDropdown: {
|
|
22
22
|
narrow: '-14.5rem',
|
|
23
|
-
wide: '-
|
|
23
|
+
wide: '-20rem'
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
anon: {
|
|
@@ -35,34 +35,34 @@ export const DropdownPositions = {
|
|
|
35
35
|
},
|
|
36
36
|
pro: {
|
|
37
37
|
catalogDropdown: {
|
|
38
|
-
narrow: '-
|
|
39
|
-
wide: '-
|
|
38
|
+
narrow: '-14.5rem',
|
|
39
|
+
wide: '-14.5rem'
|
|
40
40
|
},
|
|
41
41
|
resourceDropdown: {
|
|
42
|
-
narrow: '-
|
|
43
|
-
wide: '-
|
|
42
|
+
narrow: '-20rem',
|
|
43
|
+
wide: '-20rem'
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
teams: {
|
|
47
47
|
catalogDropdown: {
|
|
48
|
-
narrow: '-
|
|
49
|
-
wide: '-
|
|
48
|
+
narrow: '-14.5rem',
|
|
49
|
+
wide: '-14.5rem'
|
|
50
50
|
},
|
|
51
51
|
resourceDropdown: {
|
|
52
|
-
narrow: '-
|
|
53
|
-
wide: '-
|
|
52
|
+
narrow: '-20rem',
|
|
53
|
+
wide: '-20rem'
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
// won't be used, but is here to handle the case where the header type is not one of the above
|
|
57
57
|
// other header types are not part of the experiment
|
|
58
58
|
default: {
|
|
59
59
|
catalogDropdown: {
|
|
60
|
-
narrow: '-
|
|
61
|
-
wide: '-
|
|
60
|
+
narrow: '-14.5rem',
|
|
61
|
+
wide: '-14.5rem'
|
|
62
62
|
},
|
|
63
63
|
resourceDropdown: {
|
|
64
|
-
narrow: '-
|
|
65
|
-
wide: '-
|
|
64
|
+
narrow: '-20rem',
|
|
65
|
+
wide: '-20rem'
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
};
|
|
@@ -74,4 +74,8 @@ const HeaderDisplayContext = /*#__PURE__*/React.createContext({
|
|
|
74
74
|
export const useHeaderDisplayContext = () => {
|
|
75
75
|
return useContext(HeaderDisplayContext);
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
const HighlightLiveLearningContext = /*#__PURE__*/createContext(false);
|
|
78
|
+
const useHighlightLiveLearningContext = () => {
|
|
79
|
+
return useContext(HighlightLiveLearningContext);
|
|
80
|
+
};
|
|
81
|
+
export { GlobalHeaderDynamicDataContext, GlobalHeaderItemClickContext, HeaderDisplayContext, HighlightLiveLearningContext, useHighlightLiveLearningContext };
|
|
@@ -3,7 +3,7 @@ import { useTheme } from '@emotion/react';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useCallback, useMemo } from 'react';
|
|
5
5
|
import { AppHeader, AppHeaderMobile, isAppHeaderItemWithHref } from '..';
|
|
6
|
-
import { DropdownPositions, GlobalHeaderDynamicDataContext, GlobalHeaderItemClickContext, HeaderDisplayContext } from './context';
|
|
6
|
+
import { DropdownPositions, GlobalHeaderDynamicDataContext, GlobalHeaderItemClickContext, HeaderDisplayContext, HighlightLiveLearningContext } from './context';
|
|
7
7
|
import { anonDefaultHeaderItems, anonDefaultMobileHeaderItems, anonLandingHeaderItems, anonLandingMobileHeaderItems, anonLoginHeaderItems, anonLoginMobileHeaderItems, anonSignupHeaderItems, anonSignupMobileHeaderItems, enterpriseHeaderItems, enterpriseMobileHeaderItems, freeHeaderItems, freeMobileHeaderItems, loadingHeaderItems, loadingMobileHeaderItems, proHeaderItems, proMobileHeaderItems, simpleBootcampHeaderItems, simpleBootcampMobileHeaderItems, simpleHeaderItems, simpleMobileHeaderItems, teamsHeaderItems, teamsMobileHeaderItems } from './GlobalHeaderVariants';
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
export * from './types';
|
|
@@ -129,52 +129,55 @@ export const GlobalHeader = props => {
|
|
|
129
129
|
return 'default';
|
|
130
130
|
}, [props.type])
|
|
131
131
|
},
|
|
132
|
-
children: /*#__PURE__*/_jsx(
|
|
133
|
-
value: !!props.
|
|
134
|
-
children: /*#__PURE__*/_jsx(
|
|
135
|
-
value:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
132
|
+
children: /*#__PURE__*/_jsx(HighlightLiveLearningContext.Provider, {
|
|
133
|
+
value: !!props.displayHighlightLiveLearning,
|
|
134
|
+
children: /*#__PURE__*/_jsx(RevampedBlpExperimentContext.Provider, {
|
|
135
|
+
value: !!props.isInRevampedBlpExperimentVariant,
|
|
136
|
+
children: /*#__PURE__*/_jsx(GlobalHeaderItemClickContext.Provider, {
|
|
137
|
+
value: {
|
|
138
|
+
globalHeaderItemClick: combinedAction
|
|
139
|
+
},
|
|
140
|
+
children: /*#__PURE__*/_jsx(GlobalHeaderDynamicDataContext.Provider, {
|
|
141
|
+
value: useMemo(() => ({
|
|
142
|
+
globalHeaderDynamicData: dynamicData ?? null
|
|
143
|
+
}), [dynamicData]),
|
|
144
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
145
|
+
as: "header",
|
|
146
|
+
position: "sticky",
|
|
147
|
+
top: 0,
|
|
148
|
+
zIndex: theme.elements.headerZ,
|
|
149
|
+
overflow: {
|
|
150
|
+
_: 'hidden',
|
|
151
|
+
sm: 'visible'
|
|
152
|
+
} // Prevent tooltip overflow on mobile
|
|
153
|
+
,
|
|
154
|
+
children: [/*#__PURE__*/_jsx(AppHeader, {
|
|
155
|
+
action: combinedAction,
|
|
156
|
+
items: getAppHeaderItems(props, false, dynamicDataLoading ?? false),
|
|
157
|
+
search: props.search,
|
|
158
|
+
...(props.type === 'anon' ? {
|
|
159
|
+
redirectParam: props.redirectParam
|
|
160
|
+
} : hideNotification ? {} : {
|
|
161
|
+
notifications: props.notifications
|
|
162
|
+
}),
|
|
163
|
+
hideRightButtonDefaults: hideNotification,
|
|
164
|
+
isTeams: props.type === 'teams',
|
|
165
|
+
type: hideNotification ? 'enterprise' : 'standard'
|
|
166
|
+
}), /*#__PURE__*/_jsx(AppHeaderMobile, {
|
|
167
|
+
action: combinedAction,
|
|
168
|
+
items: getAppHeaderItems(props, true, dynamicDataLoading ?? false),
|
|
169
|
+
...(props.type === 'anon' || hideNotification ? {} : {
|
|
170
|
+
notifications: props.notifications
|
|
171
|
+
}),
|
|
172
|
+
search: props.search,
|
|
173
|
+
redirectParam: props.type === 'anon' ? props.redirectParam : undefined,
|
|
174
|
+
isEnterprise: props.type === 'enterprise',
|
|
175
|
+
isAnon: props.type === 'anon',
|
|
176
|
+
isSimple: props.type === 'simple',
|
|
177
|
+
hideRightMenuButton: props.type === 'simple' || props.type === 'loading',
|
|
178
|
+
navigationMenuFormattedLabel: props?.localizedLabels?.navigationMenuFormattedLabel
|
|
179
|
+
}), props.children]
|
|
180
|
+
})
|
|
178
181
|
})
|
|
179
182
|
})
|
|
180
183
|
})
|
|
@@ -32,6 +32,7 @@ interface BaseHeader extends WithChildrenProp, AppHeaderAction {
|
|
|
32
32
|
localizedLabels?: localizedLabels;
|
|
33
33
|
search: AppHeaderSearch;
|
|
34
34
|
isInRevampedBlpExperimentVariant?: boolean;
|
|
35
|
+
displayHighlightLiveLearning?: boolean;
|
|
35
36
|
dynamicData?: GlobalHeaderDynamicData | null;
|
|
36
37
|
dynamicDataLoading?: boolean;
|
|
37
38
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/brand",
|
|
3
3
|
"description": "Brand component library for Codecademy",
|
|
4
|
-
"version": "3.28.0-alpha.
|
|
4
|
+
"version": "3.28.0-alpha.0f5fb538f5.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@emotion/is-prop-valid": "^1.2.1",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { AppHeaderCatalogDropdownItem, AppHeaderResourcesDropdownItem } from '../../shared';
|
|
3
|
-
interface NavTabPanelProps extends PropsWithChildren {
|
|
4
|
-
isActiveTab: boolean;
|
|
5
|
-
index: number;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
declare const NavTabPanel: ({ children, isActiveTab, index, id, }: NavTabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare const NavTabList: React.ForwardRefExoticComponent<{
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
type: string;
|
|
12
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
declare const NavTab: ({ item, onSelect, isActive, onKeyDown, index, }: {
|
|
14
|
-
item: AppHeaderCatalogDropdownItem | AppHeaderResourcesDropdownItem;
|
|
15
|
-
onSelect: (id: string, event?: React.MouseEvent, item?: AppHeaderCatalogDropdownItem | AppHeaderResourcesDropdownItem) => void;
|
|
16
|
-
isActive: boolean;
|
|
17
|
-
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
18
|
-
index: number;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export { NavTabPanel, NavTabList, NavTab };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Box, FlexBox } from '@codecademy/gamut';
|
|
2
|
-
import { ArrowChevronRightIcon } from '@codecademy/gamut-icons';
|
|
3
|
-
import React, { useContext, useEffect, useRef } from 'react';
|
|
4
|
-
import { AppHeaderDropdownContext } from '../AppHeaderDropdownProvider';
|
|
5
|
-
import { NavIconButton, NavIconButtonContainer, NavigationButton, OverflowText, StyledNavTabPanel } from './elements';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
// Tab content, only one should be visible at a time
|
|
8
|
-
const NavTabPanel = ({
|
|
9
|
-
children,
|
|
10
|
-
isActiveTab,
|
|
11
|
-
index,
|
|
12
|
-
id
|
|
13
|
-
}) => {
|
|
14
|
-
return /*#__PURE__*/_jsx(StyledNavTabPanel, {
|
|
15
|
-
isFirst: index === 0,
|
|
16
|
-
role: "tabpanel",
|
|
17
|
-
id: `${id}-panel`,
|
|
18
|
-
"aria-labelledby": `${id}-tab`,
|
|
19
|
-
display: isActiveTab ? 'block' : 'none',
|
|
20
|
-
gridColumn: "2 / span 12",
|
|
21
|
-
gridRow: "1 / span 8",
|
|
22
|
-
bg: "background",
|
|
23
|
-
px: 32,
|
|
24
|
-
pt: 16,
|
|
25
|
-
pb: 24,
|
|
26
|
-
children: children
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Holds all of the tab buttons
|
|
31
|
-
const NavTabList = /*#__PURE__*/React.forwardRef(({
|
|
32
|
-
children,
|
|
33
|
-
type
|
|
34
|
-
}, ref) => {
|
|
35
|
-
return /*#__PURE__*/_jsx(FlexBox, {
|
|
36
|
-
role: "tablist",
|
|
37
|
-
"aria-label": `${type.replace('-dropdown', '')} navigation`,
|
|
38
|
-
"aria-orientation": "vertical",
|
|
39
|
-
flexDirection: "column",
|
|
40
|
-
gap: 8,
|
|
41
|
-
ref: ref,
|
|
42
|
-
children: children
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Tab button, lets you switch between tabs
|
|
47
|
-
// at larger breakpoints we use a normal button, at smaller
|
|
48
|
-
// breakpoints we use an IconButton.
|
|
49
|
-
const NavTab = ({
|
|
50
|
-
item,
|
|
51
|
-
onSelect,
|
|
52
|
-
isActive,
|
|
53
|
-
onKeyDown,
|
|
54
|
-
index
|
|
55
|
-
}) => {
|
|
56
|
-
const sharedButtonProps = {
|
|
57
|
-
role: 'tab',
|
|
58
|
-
'aria-selected': isActive,
|
|
59
|
-
'aria-controls': `${item.id}-panel`,
|
|
60
|
-
onClick: event => onSelect(item.id, event, item),
|
|
61
|
-
onKeyDown,
|
|
62
|
-
tabIndex: isActive ? 0 : -1,
|
|
63
|
-
isActive,
|
|
64
|
-
id: `${item.id}-tab`
|
|
65
|
-
};
|
|
66
|
-
const buttonRef = useRef(null);
|
|
67
|
-
const {
|
|
68
|
-
setFirstItemRef
|
|
69
|
-
} = useContext(AppHeaderDropdownContext);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (index === 0 && buttonRef.current) {
|
|
72
|
-
setFirstItemRef?.(buttonRef.current);
|
|
73
|
-
}
|
|
74
|
-
}, [index, setFirstItemRef]);
|
|
75
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
76
|
-
children: [/*#__PURE__*/_jsxs(NavigationButton, {
|
|
77
|
-
ref: buttonRef,
|
|
78
|
-
...sharedButtonProps,
|
|
79
|
-
children: [/*#__PURE__*/_jsxs(FlexBox, {
|
|
80
|
-
gap: 8,
|
|
81
|
-
alignItems: "center",
|
|
82
|
-
children: [item.icon && /*#__PURE__*/_jsx(Box, {
|
|
83
|
-
height: 24,
|
|
84
|
-
width: 24,
|
|
85
|
-
children: /*#__PURE__*/_jsx(item.icon, {
|
|
86
|
-
size: 24
|
|
87
|
-
})
|
|
88
|
-
}), /*#__PURE__*/_jsx(OverflowText, {
|
|
89
|
-
variant: "p-large",
|
|
90
|
-
maxWidth: {
|
|
91
|
-
_: '110px',
|
|
92
|
-
md: 'none'
|
|
93
|
-
},
|
|
94
|
-
children: item.text
|
|
95
|
-
})]
|
|
96
|
-
}), isActive && /*#__PURE__*/_jsx(Box, {
|
|
97
|
-
display: {
|
|
98
|
-
_: 'none',
|
|
99
|
-
sm: 'block'
|
|
100
|
-
},
|
|
101
|
-
mt: 4,
|
|
102
|
-
children: /*#__PURE__*/_jsx(ArrowChevronRightIcon, {
|
|
103
|
-
"data-testid": "chevron-right-icon"
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
}), item.icon && /*#__PURE__*/_jsx(NavIconButtonContainer, {
|
|
107
|
-
display: {
|
|
108
|
-
_: 'none',
|
|
109
|
-
xs: 'grid',
|
|
110
|
-
sm: 'none'
|
|
111
|
-
},
|
|
112
|
-
...sharedButtonProps,
|
|
113
|
-
children: /*#__PURE__*/_jsx(NavIconButton, {
|
|
114
|
-
icon: item.icon,
|
|
115
|
-
tip: item.text,
|
|
116
|
-
tipProps: {
|
|
117
|
-
alignment: 'right-center',
|
|
118
|
-
narrow: false,
|
|
119
|
-
placement: 'floating'
|
|
120
|
-
},
|
|
121
|
-
"aria-label": item.text
|
|
122
|
-
})
|
|
123
|
-
})]
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
export { NavTabPanel, NavTabList, NavTab };
|