File tree Expand file tree Collapse file tree 2 files changed +88
-0
lines changed
dotcom-rendering/src/layouts Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+ import type { Meta , StoryObj } from '@storybook/react-webpack5' ;
2+ import { allModes } from '../../.storybook/modes' ;
3+ import { HostedLayout } from './HostedLayout' ;
4+
5+ const meta = {
6+ title : 'Layouts/Hosted' ,
7+ component : HostedLayout ,
8+ parameters : {
9+ chromatic : {
10+ modes : {
11+ 'light leftCol' : allModes [ 'light leftCol' ] ,
12+ } ,
13+ } ,
14+ } ,
15+ } satisfies Meta < typeof HostedLayout > ;
16+
17+ export default meta ;
18+
19+ type Story = StoryObj < typeof meta > ;
20+
21+ export const Apps = {
22+ args : {
23+ renderingTarget : 'Apps' ,
24+ } ,
25+ parameters : {
26+ config : {
27+ renderingTarget : 'Apps' ,
28+ } ,
29+ } ,
30+ } satisfies Story ;
31+
32+ export const Web = {
33+ args : {
34+ renderingTarget : 'Web' ,
35+ } ,
36+ parameters : {
37+ config : {
38+ renderingTarget : 'Web' ,
39+ } ,
40+ } ,
41+ } satisfies Story ;
Original file line number Diff line number Diff line change 1+ import { css } from '@emotion/react' ;
2+ import { RenderingTarget } from 'src/types/renderingTarget' ;
3+ import { grid } from '../grid' ;
4+
5+ interface Props {
6+ renderingTarget : RenderingTarget ;
7+ }
8+
9+ interface WebProps extends Props {
10+ renderingTarget : 'Web' ;
11+ }
12+
13+ interface AppProps extends Props {
14+ renderingTarget : 'Apps' ;
15+ }
16+
17+ const border = css `
18+ border : 1px solid black;
19+ ` ;
20+
21+ export const HostedLayout = ( props : WebProps | AppProps ) => {
22+ return (
23+ < >
24+ { props . renderingTarget === 'Web' ? 'Masthead' : null }
25+ < main >
26+ < header css = { [ grid . container , border ] } >
27+ < div css = { [ grid . column . all ] } > Main media</ div >
28+ < div
29+ css = { [ grid . between ( 'centre-column-start' , 'grid-end' ) ] }
30+ >
31+ Headline
32+ </ div >
33+ </ header >
34+ < div css = { [ grid . container ] } >
35+ < div css = { [ grid . column . left ] } > Left column</ div >
36+ < div css = { [ grid . column . right ] } > Right column</ div >
37+ < div css = { [ border , grid . column . centre ] } > Standfirst</ div >
38+ < div css = { [ border , grid . column . centre ] } > Meta</ div >
39+ < article css = { [ border , grid . column . centre ] } > Body</ article >
40+ </ div >
41+ < div css = { [ grid . container ] } >
42+ < div css = { [ border , grid . column . all ] } > Onward</ div >
43+ </ div >
44+ </ main >
45+ </ >
46+ ) ;
47+ } ;
You can’t perform that action at this time.
0 commit comments