diff --git a/pages/03-core/in-iframe.page.tsx b/pages/03-core/in-iframe.page.tsx new file mode 100644 index 00000000..6dc19fbc --- /dev/null +++ b/pages/03-core/in-iframe.page.tsx @@ -0,0 +1,77 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { omit } from "lodash"; + +import ColumnLayout from "@cloudscape-design/components/column-layout"; + +import CoreChart from "../../lib/components/internal-do-not-use/core-chart"; +import { dateFormatter } from "../common/formatters"; +import { useChartSettings } from "../common/page-settings"; +import { Page } from "../common/templates"; + +export default function () { + const { chartProps } = useChartSettings(); + return ( + + + + + + + + ); +} diff --git a/pages/06-visual-tests/in-iframe.page.tsx b/pages/06-visual-tests/in-iframe.page.tsx index 4b0577ec..653073a0 100644 --- a/pages/06-visual-tests/in-iframe.page.tsx +++ b/pages/06-visual-tests/in-iframe.page.tsx @@ -6,41 +6,34 @@ import { omit } from "lodash"; import CoreChart from "../../lib/components/internal-do-not-use/core-chart"; import { useChartSettings } from "../common/page-settings"; import { Page } from "../common/templates"; -import { IframeWrapper } from "../utils/iframe-wrapper"; export default function () { + const { chartProps } = useChartSettings(); return ( - - { - const { chartProps } = useChartSettings(); - return ( - { - setTimeout(() => { - if (api.chart.series) { - const point = api.chart.series[0].data.find((p) => p.y === 10)!; - api.highlightChartPoint(point); - } - }, 0); - }} - /> - ); + + { + setTimeout(() => { + if (api.chart.series) { + const point = api.chart.series[0].data.find((p) => p.y === 10)!; + api.highlightChartPoint(point); + } + }, 0); }} /> diff --git a/pages/common/templates.tsx b/pages/common/templates.tsx index f4065680..17f07d9c 100644 --- a/pages/common/templates.tsx +++ b/pages/common/templates.tsx @@ -14,6 +14,7 @@ import Header from "@cloudscape-design/components/header"; import SpaceBetween from "@cloudscape-design/components/space-between"; import AppContext from "../app/app-context"; +import { IframeWrapper } from "../utils/iframe-wrapper"; import { ScreenshotArea } from "./screenshot-area"; import styles from "./styles.module.scss"; @@ -48,12 +49,14 @@ export function Page({ settings, children, screenshotArea = true, + iframe, }: { title: React.ReactNode; subtitle?: React.ReactNode; settings?: React.ReactNode; children: React.ReactNode; screenshotArea?: boolean; + iframe?: { id?: string }; }) { const { urlParams } = useContext(AppContext); const [toolsOpen, setToolsOpen] = useState(!urlParams.screenshotMode); @@ -70,6 +73,19 @@ export function Page({ }, }); } + + const content = ( + +

{title}

+ {subtitle && !urlParams.screenshotMode && ( + + {subtitle} + + )} + {screenshotArea ? {children} : children} +
+ ); + return ( setToolsOpen(!!detail.activeDrawerId)} drawers={drawers} - content={ - -

{title}

- {subtitle && !urlParams.screenshotMode && ( - - {subtitle} - - )} - {screenshotArea ? {children} : children} -
- } + content={iframe ? content} /> : content} /> ); }