diff --git a/.changeset/html-preview-segmented-control.md b/.changeset/html-preview-segmented-control.md new file mode 100644 index 00000000..710a988d --- /dev/null +++ b/.changeset/html-preview-segmented-control.md @@ -0,0 +1,5 @@ +--- +'@guardian/stand': patch +--- + +HtmlPreview / HtmlPreviewLoader: switch preview widths with a `SegmentedControl` (plain number labels) instead of a `RadioGroup`. The control now sits below the title, aligned with the left edge of the centred preview, and moves with it. The layout also follows the updated design: a 1px border, 16px padding and gap on the container, a Heading 2xl string title, and a transparent preview frame. New `borderColor`, `borderStyle`, `borderWidth` and `gap` theme tokens were added. diff --git a/src/components/HtmlPreviewLoader/HtmlPreview.tsx b/src/components/HtmlPreviewLoader/HtmlPreview.tsx index 52ea3a0e..1edd70fb 100644 --- a/src/components/HtmlPreviewLoader/HtmlPreview.tsx +++ b/src/components/HtmlPreviewLoader/HtmlPreview.tsx @@ -1,19 +1,21 @@ -import { css } from '@emotion/react'; import { useState } from 'react'; import { mergeDeep } from '../../util/mergeDeep'; import { AlertBanner } from '../AlertBanner/AlertBanner'; import { Button } from '../Button/Button'; import { Icon } from '../Icon/Icon'; -import { Radio, RadioGroup } from '../RadioGroup/RadioGroup'; +import { + SegmentedControl, + SegmentedControlItem, +} from '../SegmentedControl/SegmentedControl'; import { Typography } from '../Typography/Typography'; import { alertBannerContentsStyle, centeredStyle, defaultHtmlPreviewLoaderTheme, - headerStyles, htmlPreviewLoaderStyles, iframeStyle, loadingIconStyle, + previewColumnStyle, previewFrameStyle, reloadButtonStyle, spinAnimationStyle, @@ -43,39 +45,15 @@ export const HtmlPreview = ({ return (
-
- {typeof title === 'string' ? ( - {title} - ) : ( - title - )} - {widthOptions.length > 0 && ( - setFrameWidth(Number(value))} - > - {widthOptions.map((width, index) => ( - - {width}px - - ))} - - )} -
+ {title ? ( +
+ {typeof title === 'string' ? ( + {title} + ) : ( + title + )} +
+ ) : null}
- {html && ( -