@codecademy/brand 0.13.59 → 0.13.60-alpha.5acc662d07.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.
@@ -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, {
@@ -13,7 +13,6 @@ interface ToggleSearch {
13
13
  }
14
14
  export interface AppHeaderSearch extends OnSearch, onTrackingClick {
15
15
  onEnable: () => void;
16
- newCertPathsEnabled?: boolean;
17
16
  }
18
17
  export interface SearchButtonProps extends ToggleSearch {
19
18
  isSearchVisible: boolean;
@@ -1,5 +1,5 @@
1
1
  import { AppHeaderSearch } from './types';
2
- export declare const useHeaderSearch: ({ onEnable, onSearch, onTrackingClick, onSearchAsYouType, newCertPathsEnabled, }: AppHeaderSearch) => readonly [{
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__*/_jsxs(Box, {
67
- as: "header",
68
- position: "sticky",
69
- top: 0,
70
- zIndex: theme.elements.headerZ,
71
- children: [/*#__PURE__*/_jsx(AppHeader, {
72
- action: combinedAction,
73
- items: getAppHeaderItems(props, false),
74
- search: props.search,
75
- ...(props.type === 'anon' ? {
76
- redirectParam: props.redirectParam
77
- } : hideNotification ? {} : {
78
- notifications: props.notifications
79
- }),
80
- hideRightButtonDefaults: hideNotification,
81
- isAnon: props.type === 'anon',
82
- isTeams: props.type === 'teams'
83
- }), /*#__PURE__*/_jsx(AppHeaderMobile, {
84
- action: combinedAction,
85
- items: getAppHeaderItems(props, true),
86
- ...(props.type === 'anon' || hideNotification ? {} : {
87
- notifications: props.notifications
88
- }),
89
- search: props.search,
90
- redirectParam: props.type === 'anon' ? props.redirectParam : undefined,
91
- isEnterprise: props.type === 'enterprise',
92
- isAnon: props.type === 'anon',
93
- isSimple: props.type === 'simple',
94
- hideRightMenuButton: props.type === 'simple' || props.type === 'loading',
95
- navigationMenuFormattedLabel: props?.localizedLabels?.navigationMenuFormattedLabel
96
- }), props.children]
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
  };
@@ -30,6 +30,7 @@ interface BaseHeader extends WithChildrenProp, AppHeaderAction {
30
30
  hideHeaderInChromeless?: boolean;
31
31
  localizedLabels?: localizedLabels;
32
32
  search: AppHeaderSearch;
33
+ newCertPathsEnabled?: boolean;
33
34
  }
34
35
  export type User = {
35
36
  avatar: string;
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.59",
4
+ "version": "0.13.60-alpha.5acc662d07.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": "bba2dcdd162979bd492056820724255ab754737b"
50
+ "gitHead": "78d69619f39519d7d883938f8550e246f06b5ecd"
51
51
  }