@codecademy/brand 3.28.0-alpha.e4c902328e.0 → 3.28.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/AppHeaderLinkSections/index.js +0 -0
- 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
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { setupRtl } from '@codecademy/gamut-tests';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { GlobalHeaderDynamicDataContext, GlobalHeaderItemClickContext } from '../../../GlobalHeader/context';
|
|
5
|
+
import { CATALOG_NAV_SECTIONS } from '../AppHeaderCatalogDropdown/consts';
|
|
6
|
+
import { MarketingBanner } from '../AppHeaderCatalogDropdown/MarketingBanner';
|
|
7
|
+
import { AppHeaderSection } from '.';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const mockOnClick = jest.fn();
|
|
10
|
+
const mockKeyDownEvents = jest.fn();
|
|
11
|
+
const mockItem = {
|
|
12
|
+
text: 'catalog',
|
|
13
|
+
id: 'the-catalog',
|
|
14
|
+
type: 'catalog-dropdown',
|
|
15
|
+
trackingTarget: 'catalog-dropdown'
|
|
16
|
+
};
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
item: mockItem,
|
|
19
|
+
isOpen: true,
|
|
20
|
+
keyDownEvents: mockKeyDownEvents
|
|
21
|
+
};
|
|
22
|
+
const mockContextValue = {
|
|
23
|
+
globalHeaderItemClick: mockOnClick
|
|
24
|
+
};
|
|
25
|
+
const mockDataContextValue = {
|
|
26
|
+
globalHeaderDynamicData: {
|
|
27
|
+
catalogDropdown: {
|
|
28
|
+
banner: {
|
|
29
|
+
href: 'https://example.com',
|
|
30
|
+
text: 'Test banner text'
|
|
31
|
+
},
|
|
32
|
+
skillPaths: {
|
|
33
|
+
totalSkillPathCount: 0,
|
|
34
|
+
promotedSkillPaths: []
|
|
35
|
+
},
|
|
36
|
+
careerPaths: {
|
|
37
|
+
totalCareerPathCount: 0,
|
|
38
|
+
promotedCareerPaths: []
|
|
39
|
+
},
|
|
40
|
+
certificationPaths: {
|
|
41
|
+
totalCertificationPathCount: 0
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
describe('AppHeaderSection', () => {
|
|
47
|
+
const createWrapper = (dataContextValue = mockDataContextValue) => ({
|
|
48
|
+
children
|
|
49
|
+
}) => /*#__PURE__*/_jsx(GlobalHeaderDynamicDataContext.Provider, {
|
|
50
|
+
value: dataContextValue,
|
|
51
|
+
children: /*#__PURE__*/_jsx(GlobalHeaderItemClickContext.Provider, {
|
|
52
|
+
value: mockContextValue,
|
|
53
|
+
children: children
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
const renderView = setupRtl(AppHeaderSection, defaultProps).options({
|
|
57
|
+
wrapper: createWrapper()
|
|
58
|
+
});
|
|
59
|
+
it('renders the component ', () => {
|
|
60
|
+
const {
|
|
61
|
+
view
|
|
62
|
+
} = renderView({
|
|
63
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
64
|
+
handleClose: jest.fn(),
|
|
65
|
+
type: 'catalog-dropdown'
|
|
66
|
+
});
|
|
67
|
+
expect(view.getByRole('heading', {
|
|
68
|
+
name: 'Course topics'
|
|
69
|
+
})).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
describe('marketing banner', () => {
|
|
72
|
+
const createRenderView = bannerData => setupRtl(AppHeaderSection, defaultProps).options({
|
|
73
|
+
wrapper: createWrapper({
|
|
74
|
+
globalHeaderDynamicData: {
|
|
75
|
+
catalogDropdown: {
|
|
76
|
+
banner: bannerData,
|
|
77
|
+
skillPaths: {
|
|
78
|
+
totalSkillPathCount: 0,
|
|
79
|
+
promotedSkillPaths: []
|
|
80
|
+
},
|
|
81
|
+
careerPaths: {
|
|
82
|
+
totalCareerPathCount: 0,
|
|
83
|
+
promotedCareerPaths: []
|
|
84
|
+
},
|
|
85
|
+
certificationPaths: {
|
|
86
|
+
totalCertificationPathCount: 0
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
it('renders the marketing banner when the banner text and href are present', () => {
|
|
93
|
+
const {
|
|
94
|
+
view
|
|
95
|
+
} = renderView({
|
|
96
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
97
|
+
handleClose: jest.fn(),
|
|
98
|
+
type: 'catalog-dropdown',
|
|
99
|
+
MarketingBanner
|
|
100
|
+
});
|
|
101
|
+
expect(view.getByText('Test banner text')).toBeInTheDocument();
|
|
102
|
+
});
|
|
103
|
+
it('does not render the marketing banner when the banner href is empty', () => {
|
|
104
|
+
const {
|
|
105
|
+
view
|
|
106
|
+
} = createRenderView({
|
|
107
|
+
href: '',
|
|
108
|
+
text: 'Test banner text'
|
|
109
|
+
})({
|
|
110
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
111
|
+
handleClose: jest.fn(),
|
|
112
|
+
type: 'catalog-dropdown',
|
|
113
|
+
MarketingBanner
|
|
114
|
+
});
|
|
115
|
+
expect(view.queryByText('Test banner text')).not.toBeInTheDocument();
|
|
116
|
+
expect(view.queryByTestId('marketing-banner')).not.toBeInTheDocument();
|
|
117
|
+
});
|
|
118
|
+
it('does not render the marketing banner when the banner text is empty', () => {
|
|
119
|
+
const {
|
|
120
|
+
view
|
|
121
|
+
} = createRenderView({
|
|
122
|
+
href: 'https://example.com',
|
|
123
|
+
text: ''
|
|
124
|
+
})({
|
|
125
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
126
|
+
handleClose: jest.fn(),
|
|
127
|
+
type: 'catalog-dropdown',
|
|
128
|
+
MarketingBanner
|
|
129
|
+
});
|
|
130
|
+
expect(view.queryByTestId('marketing-banner')).not.toBeInTheDocument();
|
|
131
|
+
});
|
|
132
|
+
it('does not render the marketing banner when the banner text is empty', () => {
|
|
133
|
+
const {
|
|
134
|
+
view
|
|
135
|
+
} = createRenderView({
|
|
136
|
+
href: 'https://example.com',
|
|
137
|
+
text: ''
|
|
138
|
+
})({
|
|
139
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
140
|
+
handleClose: jest.fn(),
|
|
141
|
+
type: 'catalog-dropdown',
|
|
142
|
+
MarketingBanner
|
|
143
|
+
});
|
|
144
|
+
expect(view.queryByText('Test banner text')).not.toBeInTheDocument();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
describe('tab navigation', () => {
|
|
148
|
+
it('starts with the first tab active by default', () => {
|
|
149
|
+
const {
|
|
150
|
+
view
|
|
151
|
+
} = renderView({
|
|
152
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
153
|
+
handleClose: jest.fn(),
|
|
154
|
+
type: 'catalog-dropdown'
|
|
155
|
+
});
|
|
156
|
+
const courseTopicsButton = view.getByTestId('nav-section-course-topics');
|
|
157
|
+
expect(courseTopicsButton).toHaveAttribute('aria-expanded', 'true');
|
|
158
|
+
});
|
|
159
|
+
it('switches active tab when clicking on different sections', async () => {
|
|
160
|
+
const {
|
|
161
|
+
view
|
|
162
|
+
} = renderView({
|
|
163
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
164
|
+
handleClose: jest.fn(),
|
|
165
|
+
type: 'catalog-dropdown'
|
|
166
|
+
});
|
|
167
|
+
const careerPathsButton = view.getByTestId('nav-section-career-paths');
|
|
168
|
+
await userEvent.click(careerPathsButton);
|
|
169
|
+
expect(careerPathsButton).toHaveAttribute('aria-expanded', 'true');
|
|
170
|
+
const courseTopicsButton = view.getByTestId('nav-section-course-topics');
|
|
171
|
+
expect(courseTopicsButton).toHaveAttribute('aria-expanded', 'false');
|
|
172
|
+
});
|
|
173
|
+
it('calls tracking with correct parameters when clicking nav section', async () => {
|
|
174
|
+
const {
|
|
175
|
+
view
|
|
176
|
+
} = renderView({
|
|
177
|
+
navSections: CATALOG_NAV_SECTIONS,
|
|
178
|
+
handleClose: jest.fn(),
|
|
179
|
+
type: 'catalog-dropdown'
|
|
180
|
+
});
|
|
181
|
+
const careerPathsButton = view.getByTestId('nav-section-career-paths');
|
|
182
|
+
await userEvent.click(careerPathsButton);
|
|
183
|
+
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
184
|
+
expect(mockOnClick).toHaveBeenCalledWith(expect.anything(),
|
|
185
|
+
// event object
|
|
186
|
+
expect.objectContaining({
|
|
187
|
+
id: 'career-paths',
|
|
188
|
+
type: 'catalog-dropdown'
|
|
189
|
+
}) // tracking parameters
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare const NavIconButton: import("@emotion/styled").StyledComponent<((Omit<Omit<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
} & Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "disabled" | "content" | "translate" | "property" | "hidden" | "form" | "slot" | "style" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "type" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | keyof React.ClassAttributes<HTMLButtonElement> | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value">, "ref"> & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement> & {
|
|
8
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
9
|
+
} & import("@codecademy/gamut/dist/Button/shared").ButtonBaseProps & import("@codecademy/gamut").IconComponentType & {
|
|
10
|
+
'aria-label'?: string | undefined;
|
|
11
|
+
tip: string;
|
|
12
|
+
tipProps?: Omit<import("@codecademy/gamut").ToolTipProps, "children" | "info"> | undefined;
|
|
13
|
+
}, "ref"> | Omit<Omit<{
|
|
14
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
15
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
} & Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "disabled" | "content" | "translate" | "property" | "hidden" | "form" | "slot" | "style" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "type" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | keyof React.ClassAttributes<HTMLButtonElement> | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value"> & Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "content" | "translate" | "property" | "hidden" | "slot" | "style" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "media" | "target" | "type" | "role" | "tabIndex" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | keyof React.ClassAttributes<HTMLAnchorElement> | "download" | "hrefLang" | "ping" | "referrerPolicy">, "ref"> & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement> & {
|
|
19
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
+
} & import("@codecademy/gamut/dist/Button/shared").ButtonBaseProps & import("@codecademy/gamut").IconComponentType & {
|
|
21
|
+
'aria-label'?: string | undefined;
|
|
22
|
+
tip: string;
|
|
23
|
+
tipProps?: Omit<import("@codecademy/gamut").ToolTipProps, "children" | "info"> | undefined;
|
|
24
|
+
}, "ref">) & React.RefAttributes<import("@codecademy/gamut").ButtonBaseElements>) & {
|
|
25
|
+
theme?: import("@emotion/react").Theme;
|
|
26
|
+
}, {}, {}>;
|
|
2
27
|
export type MobileBackButtonProps = {
|
|
3
28
|
handleClose: () => void;
|
|
4
29
|
type: 'catalog-dropdown' | 'resources-dropdown';
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
import { Box, FlexBox, IconButton, Text } from '@codecademy/gamut';
|
|
2
3
|
import { ArrowLeftIcon } from '@codecademy/gamut-icons';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { useGlobalHeaderItemClick } from '../../../GlobalHeader/context';
|
|
5
|
-
import {
|
|
6
|
+
import { SmallMenuButton } from './elements';
|
|
7
|
+
import { NavigationButton } from './NavSection';
|
|
6
8
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
export const NavIconButton = /*#__PURE__*/_styled(IconButton, {
|
|
10
|
+
target: "ew664c00",
|
|
11
|
+
label: "NavIconButton"
|
|
12
|
+
})("&:hover,&:focus svg{&:hover,&:focus{color:", ({
|
|
13
|
+
theme
|
|
14
|
+
}) => theme.colors.primary, ";background-color:", ({
|
|
15
|
+
theme
|
|
16
|
+
}) => theme.colors['navy-100'], ";}}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9BcHBIZWFkZXIvQXBwSGVhZGVyRWxlbWVudHMvQXBwSGVhZGVyU2VjdGlvbi9Nb2JpbGVCYWNrQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTK0MiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjL0FwcEhlYWRlci9BcHBIZWFkZXJFbGVtZW50cy9BcHBIZWFkZXJTZWN0aW9uL01vYmlsZUJhY2tCdXR0b24udHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQm94LCBGbGV4Qm94LCBJY29uQnV0dG9uLCBUZXh0IH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQnO1xuaW1wb3J0IHsgQXJyb3dMZWZ0SWNvbiB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LWljb25zJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5cbmltcG9ydCB7IHVzZUdsb2JhbEhlYWRlckl0ZW1DbGljayB9IGZyb20gJy4uLy4uLy4uL0dsb2JhbEhlYWRlci9jb250ZXh0JztcbmltcG9ydCB7IFNtYWxsTWVudUJ1dHRvbiB9IGZyb20gJy4vZWxlbWVudHMnO1xuaW1wb3J0IHsgTmF2aWdhdGlvbkJ1dHRvbiB9IGZyb20gJy4vTmF2U2VjdGlvbic7XG5cbmV4cG9ydCBjb25zdCBOYXZJY29uQnV0dG9uID0gc3R5bGVkKEljb25CdXR0b24pYFxuICAmOmhvdmVyLFxuICAmOmZvY3VzIHN2ZyB7XG4gICAgJjpob3ZlcixcbiAgICAmOmZvY3VzIHtcbiAgICAgIGNvbG9yOiAkeyh7IHRoZW1lIH0pID0+IHRoZW1lLmNvbG9ycy5wcmltYXJ5fTtcbiAgICAgIGJhY2tncm91bmQtY29sb3I6ICR7KHsgdGhlbWUgfSkgPT4gdGhlbWUuY29sb3JzWyduYXZ5LTEwMCddfTtcbiAgICB9XG4gIH1cbmA7XG5cbmV4cG9ydCB0eXBlIE1vYmlsZUJhY2tCdXR0b25Qcm9wcyA9IHtcbiAgaGFuZGxlQ2xvc2U6ICgpID0+IHZvaWQ7XG4gIHR5cGU6ICdjYXRhbG9nLWRyb3Bkb3duJyB8ICdyZXNvdXJjZXMtZHJvcGRvd24nO1xufTtcblxuZXhwb3J0IGNvbnN0IE1vYmlsZUJhY2tCdXR0b246IFJlYWN0LkZDPE1vYmlsZUJhY2tCdXR0b25Qcm9wcz4gPSAoe1xuICBoYW5kbGVDbG9zZSxcbiAgdHlwZSxcbn0pID0+IHtcbiAgY29uc3QgeyBnbG9iYWxIZWFkZXJJdGVtQ2xpY2sgfSA9IHVzZUdsb2JhbEhlYWRlckl0ZW1DbGljaygpO1xuXG4gIGNvbnN0IGhhbmRsZUJhY2tCdXR0b25DbGljayA9IChcbiAgICBldmVudDogUmVhY3QuTW91c2VFdmVudDxIVE1MQnV0dG9uRWxlbWVudD5cbiAgKSA9PiB7XG4gICAgZ2xvYmFsSGVhZGVySXRlbUNsaWNrKGV2ZW50LCB7XG4gICAgICBpZDogJ2JhY2snLFxuICAgICAgdGV4dDogJ0JhY2snLFxuICAgICAgdHlwZSxcbiAgICB9KTtcbiAgICBoYW5kbGVDbG9zZSgpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxCb3ggZGlzcGxheT17eyBfOiAnbm9uZScsIHNtOiAnYmxvY2snIH19PlxuICAgICAgICA8TmF2aWdhdGlvbkJ1dHRvblxuICAgICAgICAgIGlzQWN0aXZlPXtmYWxzZX1cbiAgICAgICAgICBpbmRleD17MH1cbiAgICAgICAgICBvbkNsaWNrPXtoYW5kbGVCYWNrQnV0dG9uQ2xpY2t9XG4gICAgICAgID5cbiAgICAgICAgICA8RmxleEJveCBnYXA9ezh9IGFsaWduSXRlbXM9XCJjZW50ZXJcIj5cbiAgICAgICAgICAgIDxCb3ggaGVpZ2h0PXsyNH0gd2lkdGg9ezI0fT5cbiAgICAgICAgICAgICAgPEFycm93TGVmdEljb24gc2l6ZT17MjR9IC8+XG4gICAgICAgICAgICA8L0JveD5cbiAgICAgICAgICAgIDxUZXh0PkJhY2s8L1RleHQ+XG4gICAgICAgICAgPC9GbGV4Qm94PlxuICAgICAgICA8L05hdmlnYXRpb25CdXR0b24+XG4gICAgICA8L0JveD5cbiAgICAgIDxCb3hcbiAgICAgICAgZGlzcGxheT17eyBfOiAnbm9uZScsIHhzOiAnZ3JpZCcsIHNtOiAnbm9uZScgfX1cbiAgICAgICAgbWw9ezh9XG4gICAgICAgIGdyaWRDb2x1bW49XCIxXCJcbiAgICAgICAgZ3JpZFJvdz1cIjFcIlxuICAgICAgPlxuICAgICAgICA8TmF2SWNvbkJ1dHRvblxuICAgICAgICAgIG9uQ2xpY2s9e2hhbmRsZUJhY2tCdXR0b25DbGlja31cbiAgICAgICAgICBpY29uPXtBcnJvd0xlZnRJY29ufVxuICAgICAgICAgIHRpcD1cIkJhY2sgdG8gbWFpbiBuYXZpZ2F0aW9uXCJcbiAgICAgICAgICB0aXBQcm9wcz17e1xuICAgICAgICAgICAgYWxpZ25tZW50OiAncmlnaHQtY2VudGVyJyxcbiAgICAgICAgICAgIG5hcnJvdzogZmFsc2UsXG4gICAgICAgICAgICBwbGFjZW1lbnQ6ICdmbG9hdGluZycsXG4gICAgICAgICAgfX1cbiAgICAgICAgICBhcmlhLWxhYmVsPVwiQmFjayB0byBtYWluIG5hdmlnYXRpb25cIlxuICAgICAgICAvPlxuICAgICAgPC9Cb3g+XG4gICAgICA8Qm94IGRpc3BsYXk9e3sgXzogJ2ZsZXgnLCB4czogJ25vbmUnIH19PlxuICAgICAgICA8U21hbGxNZW51QnV0dG9uIGluZGV4PXswfSBvbkNsaWNrPXtoYW5kbGVCYWNrQnV0dG9uQ2xpY2t9PlxuICAgICAgICAgIDxGbGV4Qm94IGdhcD17OH0gYWxpZ25JdGVtcz1cImNlbnRlclwiPlxuICAgICAgICAgICAgPEJveCBoZWlnaHQ9ezI0fSB3aWR0aD17MjR9PlxuICAgICAgICAgICAgICA8QXJyb3dMZWZ0SWNvbiBzaXplPXsyNH0gLz5cbiAgICAgICAgICAgIDwvQm94PlxuICAgICAgICAgICAgPFRleHQ+QmFjazwvVGV4dD5cbiAgICAgICAgICA8L0ZsZXhCb3g+XG4gICAgICAgIDwvU21hbGxNZW51QnV0dG9uPlxuICAgICAgPC9Cb3g+XG4gICAgPC8+XG4gICk7XG59O1xuIl19 */"));
|
|
7
17
|
export const MobileBackButton = ({
|
|
8
18
|
handleClose,
|
|
9
19
|
type
|
|
@@ -27,6 +37,7 @@ export const MobileBackButton = ({
|
|
|
27
37
|
},
|
|
28
38
|
children: /*#__PURE__*/_jsx(NavigationButton, {
|
|
29
39
|
isActive: false,
|
|
40
|
+
index: 0,
|
|
30
41
|
onClick: handleBackButtonClick,
|
|
31
42
|
children: /*#__PURE__*/_jsxs(FlexBox, {
|
|
32
43
|
gap: 8,
|
|
@@ -2,8 +2,9 @@ import { Box, FlexBox, Text } from '@codecademy/gamut';
|
|
|
2
2
|
import { ArrowChevronRightIcon } from '@codecademy/gamut-icons';
|
|
3
3
|
import { theme } from '@codecademy/gamut-styles';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { useHighlightLiveLearningContext } from '../../../GlobalHeader/context';
|
|
5
6
|
import { useAppHeaderSectionContext } from './AppHeaderSectionContext';
|
|
6
|
-
import { SmallMenuButton } from './elements';
|
|
7
|
+
import { PopularBadge, SmallMenuButton } from './elements';
|
|
7
8
|
import { MobileBackButton } from './MobileBackButton';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
10
|
export const MobileNavMenu = ({
|
|
@@ -15,6 +16,7 @@ export const MobileNavMenu = ({
|
|
|
15
16
|
activePanel,
|
|
16
17
|
setActivePanel
|
|
17
18
|
} = useAppHeaderSectionContext();
|
|
19
|
+
const displayHighlightLiveLearning = useHighlightLiveLearningContext();
|
|
18
20
|
const ActivePanel = navSections[activePanel ?? 0].panel;
|
|
19
21
|
return /*#__PURE__*/_jsxs(FlexBox, {
|
|
20
22
|
display: {
|
|
@@ -31,6 +33,7 @@ export const MobileNavMenu = ({
|
|
|
31
33
|
}), navSections.map(({
|
|
32
34
|
item
|
|
33
35
|
}, index) => {
|
|
36
|
+
const showPopularBadge = item.id === 'live-learning' && displayHighlightLiveLearning;
|
|
34
37
|
return /*#__PURE__*/_jsxs(SmallMenuButton, {
|
|
35
38
|
index: index + 1,
|
|
36
39
|
onClick: () => setActivePanel(index),
|
|
@@ -46,8 +49,14 @@ export const MobileNavMenu = ({
|
|
|
46
49
|
}), /*#__PURE__*/_jsx(Text, {
|
|
47
50
|
children: item.text
|
|
48
51
|
})]
|
|
49
|
-
}), /*#__PURE__*/
|
|
50
|
-
children: /*#__PURE__*/_jsx(
|
|
52
|
+
}), /*#__PURE__*/_jsxs(FlexBox, {
|
|
53
|
+
children: [showPopularBadge && /*#__PURE__*/_jsx(PopularBadge, {
|
|
54
|
+
variant: "custom",
|
|
55
|
+
size: "sm",
|
|
56
|
+
bg: "hyper-400",
|
|
57
|
+
mr: 16,
|
|
58
|
+
children: "Popular"
|
|
59
|
+
}), /*#__PURE__*/_jsx(ArrowChevronRightIcon, {})]
|
|
51
60
|
})]
|
|
52
61
|
}, item.id);
|
|
53
62
|
})]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GamutIconProps } from '@codecademy/gamut-icons';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
|
+
import { AppHeaderCatalogDropdownItem, AppHeaderResourcesDropdownItem } from '../../shared';
|
|
4
|
+
type NavSectionProps = PropsWithChildren & {
|
|
5
|
+
item: AppHeaderCatalogDropdownItem | AppHeaderResourcesDropdownItem;
|
|
6
|
+
isActiveTab: boolean;
|
|
7
|
+
setActiveTab: (tab: number) => void;
|
|
8
|
+
icon?: React.ComponentType<GamutIconProps>;
|
|
9
|
+
text: string;
|
|
10
|
+
index: number;
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const NavigationButton: import("@emotion/styled").StyledComponent<{
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
} & {
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
index: number;
|
|
19
|
+
}, React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
20
|
+
declare const NavSection: ({ isActiveTab, setActiveTab, icon: Icon, text, index, children, item, tabIndex, }: NavSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default NavSection;
|