Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-tools/utils/pluralize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const pluralizationMap = {
Drawer: 'Drawers',
ErrorBoundary: 'ErrorBoundaries',
ExpandableSection: 'ExpandableSections',
FeaturePrompt: 'FeaturePrompts',
FileDropzone: 'FileDropzones',
FileInput: 'FileInputs',
FileTokenGroup: 'FileTokenGroups',
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@
{
"path": "lib/components/internal/plugins/index.js",
"brotli": false,
"limit": "15 kB"
"limit": "16 kB"
},
{
"path": "lib/components/internal/widget-exports.js",
"brotli": false,
"limit": "1150 kB",
"limit": "1250 kB",
"ignore": "react-dom"
}
],
Expand Down
2 changes: 1 addition & 1 deletion pages/app-layout-toolbar/with-content-layout.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function WithDrawers() {
const [splitPanelOpen, setSplitPanelOpen] = useState(false);
const pageLayoutRef = useRef<AppLayoutToolbarProps.Ref>(null);

const drawersProps: Pick<AppLayoutToolbarProps, 'activeDrawerId' | 'onDrawerChange' | 'drawers'> | null = {
const drawersProps: Pick<AppLayoutToolbarProps, 'activeDrawerId' | 'onDrawerChange' | 'drawers'> = {
activeDrawerId: activeDrawerId,
drawers: [
{
Expand Down
12 changes: 10 additions & 2 deletions pages/app/app-context.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { createContext, useContext } from 'react';
import React, { createContext, useContext, useState } from 'react';
import { useHistory, useLocation, useRouteMatch } from 'react-router-dom';
import mapValues from 'lodash/mapValues';

Expand All @@ -23,6 +23,8 @@ export interface AppContextType<T = unknown> {
urlParams: AppUrlParams & T;
setUrlParams: (newParams: Partial<AppUrlParams & T>) => void;
setMode: (newMode: Mode) => void;
header: null | React.ReactNode;
setHeader: (header: React.ReactNode) => void;
}

const appContextDefaults: AppContextType = {
Expand All @@ -37,6 +39,8 @@ const appContextDefaults: AppContextType = {
},
setMode: () => {},
setUrlParams: () => {},
header: null,
setHeader: () => {},
};

const AppContext = createContext<AppContextType>(appContextDefaults);
Expand Down Expand Up @@ -100,8 +104,12 @@ export function AppContextProvider({ children }: { children: React.ReactNode })
}
}

const [header, setHeader] = useState<React.ReactNode>(null);

return (
<AppContext.Provider value={{ mode, pageId, urlParams, setUrlParams: setUrlParams, setMode: updateMode }}>
<AppContext.Provider
value={{ mode, pageId, urlParams, setUrlParams: setUrlParams, setMode: updateMode, header, setHeader }}
>
{children}
</AppContext.Provider>
);
Expand Down
12 changes: 8 additions & 4 deletions pages/app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ import ThemeSwitcher from './theme-switcher';
import styles from './header.scss';

export default function Header({ sticky }: { sticky?: boolean }) {
const { mode } = useContext(AppContext);
const { mode, header: customHeader } = useContext(AppContext);
return (
<>
{/* #h selector for compatibility with global navigation */}
<header id="h" className={clsx(styles.header, sticky && styles['header-sticky'])}>
<Link to={`/${mode}/`}>Demo Assets</Link>
<ThemeSwitcher />
<header id="h" className={clsx(!customHeader && styles.header, sticky && styles['header-sticky'])}>
{customHeader ?? (
<>
<Link to={`/${mode}/`}>Demo Assets</Link>
<ThemeSwitcher />
</>
)}
</header>
</>
);
Expand Down
2 changes: 2 additions & 0 deletions pages/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ function isAppLayoutPage(pageId?: string) {
'funnel-analytics/static-single-page-flow',
'funnel-analytics/static-multi-page-flow',
'charts.test',
'notifications-strategy',
'error-boundary/demo-async-load',
'error-boundary/demo-components',
'notifications-strategy',
];
return pageId !== undefined && appLayoutPages.some(match => pageId.includes(match));
}
Expand Down
4 changes: 3 additions & 1 deletion pages/app/templates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function SimplePage({ title, subtitle, settings, children, screenshotArea
<SpaceBetween size="m">{children}</SpaceBetween>
</ScreenshotArea>
) : (
<Box>{children}</Box>
<Box>
<SpaceBetween size="m">{children}</SpaceBetween>
</Box>
)}
</SpaceBetween>
</Box>
Expand Down
Loading
Loading