@codecademy/brand 0.13.59 → 0.13.60-alpha.7308f73537.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/AppHeaderCatalogSection/index.js +14 -4
- package/dist/AppHeader/Search/types.d.ts +0 -1
- package/dist/AppHeader/Search/useHeaderSearch.d.ts +1 -1
- package/dist/AppHeader/Search/useHeaderSearch.js +6 -3
- package/dist/GlobalHeader/index.d.ts +3 -0
- package/dist/GlobalHeader/index.js +39 -31
- package/dist/GlobalHeader/types.d.ts +1 -0
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import { TinyBlocks } from '@codecademy/gamut-illustrations';
|
|
|
4
4
|
import { Background } from '@codecademy/gamut-styles';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { useContext, useEffect, useRef } from 'react';
|
|
7
|
-
import { HeaderQuizContext } from '../../../GlobalHeader';
|
|
7
|
+
import { CertPathContext, HeaderQuizContext } from '../../../GlobalHeader';
|
|
8
8
|
import { careerPaths, getTopSubjects, topLanguages } from '../../../lib/catalogList';
|
|
9
9
|
import { DescriptionSectionContainer, LayoutGridAntiAliased, useMegaMenuHeaderResponsiveStyles } from '../../shared';
|
|
10
10
|
import { useAppHeaderDropdownContext } from '../AppHeaderDropdownProvider';
|
|
@@ -35,9 +35,16 @@ const itHighlightData = {
|
|
|
35
35
|
text: 'Stand out in IT with new skill paths to prepare for top industry certifications.',
|
|
36
36
|
id: 'nav-highlight',
|
|
37
37
|
type: 'link',
|
|
38
|
-
href: '/catalog/subject/information-technology?type=skill-path
|
|
38
|
+
href: '/catalog/subject/information-technology?type=skill-path',
|
|
39
39
|
trackingTarget: 'topnav_catalog_banner_it'
|
|
40
40
|
};
|
|
41
|
+
const certPrepHighlight = {
|
|
42
|
+
text: 'Prepare for top industry certifications — explore certification prep paths.',
|
|
43
|
+
id: 'nav-highlight',
|
|
44
|
+
type: 'link',
|
|
45
|
+
href: '/catalog/certification-prep',
|
|
46
|
+
trackingTarget: 'topnav_catalog_banner_certification_prep'
|
|
47
|
+
};
|
|
41
48
|
export const AppHeaderCatalogSection = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
42
49
|
let {
|
|
43
50
|
action,
|
|
@@ -54,6 +61,9 @@ export const AppHeaderCatalogSection = /*#__PURE__*/React.forwardRef((_ref, ref)
|
|
|
54
61
|
showOnboardingQuiz,
|
|
55
62
|
showSortingQuiz
|
|
56
63
|
} = useContext(HeaderQuizContext);
|
|
64
|
+
const {
|
|
65
|
+
newCertPathsEnabled
|
|
66
|
+
} = useContext(CertPathContext);
|
|
57
67
|
const tabIndex = isOpen === false ? -1 : 0;
|
|
58
68
|
const styles = useMegaMenuHeaderResponsiveStyles();
|
|
59
69
|
const bannerStyles = useBannerResponsiveStyles();
|
|
@@ -63,7 +73,7 @@ export const AppHeaderCatalogSection = /*#__PURE__*/React.forwardRef((_ref, ref)
|
|
|
63
73
|
setFirstItemRef(firstElemRef.current);
|
|
64
74
|
}
|
|
65
75
|
}, [setFirstItemRef, firstElemRef]);
|
|
66
|
-
const navHighlightData = itHighlightData;
|
|
76
|
+
const navHighlightData = newCertPathsEnabled ? certPrepHighlight : itHighlightData;
|
|
67
77
|
const topSubjects = getTopSubjects();
|
|
68
78
|
const onClick = (event, linkItem) => {
|
|
69
79
|
handleClose?.();
|
|
@@ -176,7 +186,7 @@ export const AppHeaderCatalogSection = /*#__PURE__*/React.forwardRef((_ref, ref)
|
|
|
176
186
|
children: /*#__PURE__*/_jsxs(FlexBox, {
|
|
177
187
|
alignItems: "center",
|
|
178
188
|
gap: 8,
|
|
179
|
-
children: [item.text, item.badge]
|
|
189
|
+
children: [item.text, !newCertPathsEnabled && item.badge]
|
|
180
190
|
})
|
|
181
191
|
})
|
|
182
192
|
}, item.id)), topSubjects.map(item => /*#__PURE__*/_jsx(Box, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppHeaderSearch } from './types';
|
|
2
|
-
export declare const useHeaderSearch: ({ onEnable, onSearch, onTrackingClick, onSearchAsYouType,
|
|
2
|
+
export declare const useHeaderSearch: ({ onEnable, onSearch, onTrackingClick, onSearchAsYouType, }: AppHeaderSearch) => readonly [{
|
|
3
3
|
readonly id: "search";
|
|
4
4
|
readonly type: "render-element";
|
|
5
5
|
readonly renderElement: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useRef, useState } from 'react';
|
|
1
|
+
import { useContext, useRef, useState } from 'react';
|
|
2
|
+
import { CertPathContext } from '../..';
|
|
2
3
|
import { AnimatedHeaderZone } from '../shared';
|
|
3
4
|
import { SearchButton } from './SearchButton';
|
|
4
5
|
import { SearchPane } from './SearchPane';
|
|
@@ -8,11 +9,13 @@ export const useHeaderSearch = _ref => {
|
|
|
8
9
|
onEnable,
|
|
9
10
|
onSearch,
|
|
10
11
|
onTrackingClick,
|
|
11
|
-
onSearchAsYouType
|
|
12
|
-
newCertPathsEnabled
|
|
12
|
+
onSearchAsYouType
|
|
13
13
|
} = _ref;
|
|
14
14
|
const [isSearchVisible, setIsSearchVisible] = useState(false);
|
|
15
15
|
const searchButtonRef = useRef(null);
|
|
16
|
+
const {
|
|
17
|
+
newCertPathsEnabled
|
|
18
|
+
} = useContext(CertPathContext);
|
|
16
19
|
const toggleSearch = () => {
|
|
17
20
|
if (!isSearchVisible) {
|
|
18
21
|
onEnable();
|
|
@@ -6,4 +6,7 @@ export declare const HeaderQuizContext: React.Context<{
|
|
|
6
6
|
showOnboardingQuiz?: boolean;
|
|
7
7
|
showSortingQuiz?: boolean;
|
|
8
8
|
}>;
|
|
9
|
+
export declare const CertPathContext: React.Context<{
|
|
10
|
+
newCertPathsEnabled: boolean;
|
|
11
|
+
}>;
|
|
9
12
|
export declare const GlobalHeader: React.FC<GlobalHeaderProps>;
|
|
@@ -45,6 +45,9 @@ export const HeaderQuizContext = /*#__PURE__*/React.createContext({
|
|
|
45
45
|
showOnboardingQuiz: false,
|
|
46
46
|
showSortingQuiz: false
|
|
47
47
|
});
|
|
48
|
+
export const CertPathContext = /*#__PURE__*/React.createContext({
|
|
49
|
+
newCertPathsEnabled: false
|
|
50
|
+
});
|
|
48
51
|
export const GlobalHeader = props => {
|
|
49
52
|
const {
|
|
50
53
|
action,
|
|
@@ -63,37 +66,42 @@ export const GlobalHeader = props => {
|
|
|
63
66
|
showOnboardingQuiz,
|
|
64
67
|
showSortingQuiz
|
|
65
68
|
},
|
|
66
|
-
children: /*#__PURE__*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
children: /*#__PURE__*/_jsx(CertPathContext.Provider, {
|
|
70
|
+
value: {
|
|
71
|
+
newCertPathsEnabled: !!props.newCertPathsEnabled
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
74
|
+
as: "header",
|
|
75
|
+
position: "sticky",
|
|
76
|
+
top: 0,
|
|
77
|
+
zIndex: theme.elements.headerZ,
|
|
78
|
+
children: [/*#__PURE__*/_jsx(AppHeader, {
|
|
79
|
+
action: combinedAction,
|
|
80
|
+
items: getAppHeaderItems(props, false),
|
|
81
|
+
search: props.search,
|
|
82
|
+
...(props.type === 'anon' ? {
|
|
83
|
+
redirectParam: props.redirectParam
|
|
84
|
+
} : hideNotification ? {} : {
|
|
85
|
+
notifications: props.notifications
|
|
86
|
+
}),
|
|
87
|
+
hideRightButtonDefaults: hideNotification,
|
|
88
|
+
isAnon: props.type === 'anon',
|
|
89
|
+
isTeams: props.type === 'teams'
|
|
90
|
+
}), /*#__PURE__*/_jsx(AppHeaderMobile, {
|
|
91
|
+
action: combinedAction,
|
|
92
|
+
items: getAppHeaderItems(props, true),
|
|
93
|
+
...(props.type === 'anon' || hideNotification ? {} : {
|
|
94
|
+
notifications: props.notifications
|
|
95
|
+
}),
|
|
96
|
+
search: props.search,
|
|
97
|
+
redirectParam: props.type === 'anon' ? props.redirectParam : undefined,
|
|
98
|
+
isEnterprise: props.type === 'enterprise',
|
|
99
|
+
isAnon: props.type === 'anon',
|
|
100
|
+
isSimple: props.type === 'simple',
|
|
101
|
+
hideRightMenuButton: props.type === 'simple' || props.type === 'loading',
|
|
102
|
+
navigationMenuFormattedLabel: props?.localizedLabels?.navigationMenuFormattedLabel
|
|
103
|
+
}), props.children]
|
|
104
|
+
})
|
|
97
105
|
})
|
|
98
106
|
});
|
|
99
107
|
};
|
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": "0.13.
|
|
4
|
+
"version": "0.13.60-alpha.7308f73537.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@emotion/is-prop-valid": "1.2.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"dist/**/[A-Z]**/[A-Z]*.js",
|
|
48
48
|
"dist/**/[A-Z]**/index.js"
|
|
49
49
|
],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d43a8ce672437e781a14f6df5a35e195bd0e0353"
|
|
51
51
|
}
|