Skip to content
Merged
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
3 changes: 2 additions & 1 deletion dotcom-rendering/src/devServer/docs/article.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Available } from './available';
import { descriptionLinks } from './styles';

const OtherExamples = () => (
<>
<h3>Other Examples</h3>
<dl>
<dl css={descriptionLinks}>
<dt>
<a href="https://www.theguardian.com/tone/minutebyminute">
Minute-by-minute tag page
Expand Down
21 changes: 18 additions & 3 deletions dotcom-rendering/src/devServer/docs/available.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { space, textEgyptianBold17Object } from '@guardian/source/foundations';

type Target = 'dotcom' | 'live apps' | 'editions app' | 'amp';

const href = (target: Target): string => {
Expand Down Expand Up @@ -27,9 +29,22 @@ function* links(targets: Target[]) {

export const Available = ({ targets }: { targets: Target[] }) => (
<dl>
<dt>Available targets</dt>
<dd>
<ul>{Array.from(links(targets))}</ul>
<dt css={textEgyptianBold17Object}>Available targets:</dt>
<dd
css={{
margin: 0,
}}
>
<ul
css={{
listStyle: 'none',
padding: 0,
display: 'flex',
gap: space[3],
}}
>
{Array.from(links(targets))}
</ul>
</dd>
</dl>
);
90 changes: 74 additions & 16 deletions dotcom-rendering/src/devServer/docs/doc.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { css } from '@emotion/react';
import {
article17Object,
headlineBold24Object,
headlineMedium20Object,
headlineMedium24Object,
headlineMedium34Object,
palette,
space,
} from '@guardian/source/foundations';
import type { ReactNode } from 'react';
import { grid } from '../../grid';

const Charset = () => <meta charSet="UTF-8" />;

Expand All @@ -16,25 +27,72 @@ const Head = ({ title, path }: { title: string; path: string }) => (
);

const Body = ({ title, children }: { title: string; children: ReactNode }) => (
<body>
<nav>
<ul>
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/pages">Pages</a>
</li>
<li>
<a href="/targets">Targets</a>
</li>
</ul>
</nav>
<h1>{title}</h1>
{children}
<body
css={{
h1: headlineMedium34Object,
h2: {
...headlineMedium24Object,
borderBottomWidth: 1,
borderBottomStyle: 'solid',
borderBottomColor: palette.neutral[86],
marginTop: space[9],
marginBottom: 0,
},
h3: headlineMedium20Object,
a: {
color: palette.brand[400],
textUnderlineOffset: 5,
},
['&']: css(grid.container),
margin: 0,
...article17Object,
}}
>
<Nav />
<main css={grid.column.centre}>
<h1>{title}</h1>
{children}
</main>
</body>
);

const Nav = () => (
<nav
css={{
a: {
textDecoration: 'none',
color: palette.neutral[100],
},
display: 'grid',
gridTemplateColumns: 'subgrid',
['&']: css(grid.column.all),
backgroundColor: palette.brand[400],
...headlineBold24Object,
}}
>
<ul
css={{
listStyle: 'none',
padding: 0,
margin: `${space[3]}px 0`,
display: 'flex',
gap: space[6],
['&']: css(grid.column.centre),
}}
>
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/pages">Pages</a>
</li>
<li>
<a href="/targets">Targets</a>
</li>
</ul>
</nav>
);

export const Doc = ({
title,
path,
Expand Down
11 changes: 11 additions & 0 deletions dotcom-rendering/src/devServer/docs/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { css } from '@emotion/react';
import { space } from '@guardian/source/foundations';

export const descriptionLinks = css({
dt: {
paddingBottom: space[1],
},
dd: {
paddingBottom: space[1],
},
});