Skip to content

Commit 419d593

Browse files
committed
Move accompanying components above main component, move styles above components
1 parent 4f1805e commit 419d593

File tree

1 file changed

+83
-81
lines changed

1 file changed

+83
-81
lines changed

dotcom-rendering/src/components/MoreGalleries.tsx

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,88 @@ const cardsContainerStyles = css`
8080
}
8181
`;
8282

83+
const headerStyles = css`
84+
color: ${palette('--carousel-text')};
85+
${headlineBold24};
86+
padding-bottom: ${space[3]}px;
87+
padding-top: ${space[1]}px;
88+
89+
:hover {
90+
text-decoration: underline;
91+
}
92+
93+
${from.tablet} {
94+
${headlineBold28};
95+
}
96+
`;
97+
98+
const Title = ({ guardianBaseUrl }: { guardianBaseUrl: string }) => (
99+
<a
100+
css={css`
101+
${grid.column.centre}
102+
color: ${palette('--caption-text')};
103+
text-decoration: none;
104+
align-self: start;
105+
106+
${from.leftCol} {
107+
${grid.column.left}
108+
}
109+
`}
110+
href={`${guardianBaseUrl}/inpictures/all`}
111+
data-link-name="section heading"
112+
>
113+
<h2 css={headerStyles}>More galleries</h2>
114+
</a>
115+
);
116+
117+
const MoreGalleriesSplashCard = ({
118+
defaultProps,
119+
}: {
120+
defaultProps: CardProps;
121+
}) => {
122+
const cardProps: Partial<CardProps> = {
123+
headlineSizes: {
124+
desktop: 'medium',
125+
tablet: 'medium',
126+
mobile: 'medium',
127+
},
128+
mediaPositionOnDesktop: 'right',
129+
mediaPositionOnMobile: 'top',
130+
mediaSize: 'medium',
131+
isOnwardSplash: true,
132+
};
133+
134+
return (
135+
<div
136+
css={[
137+
cardsContainerStyles,
138+
css`
139+
margin-bottom: ${space[6]}px;
140+
background-color: ${palette(
141+
'--onward-more-galleries-card-background',
142+
)};
143+
padding: ${space[2]}px;
144+
${from.leftCol} {
145+
&::before {
146+
content: '';
147+
position: absolute;
148+
left: -11px;
149+
top: 8px;
150+
bottom: 0;
151+
width: 1px;
152+
background-color: ${palette(
153+
'--onward-content-border',
154+
)};
155+
}
156+
}
157+
`,
158+
]}
159+
>
160+
<Card {...defaultProps} {...cardProps} />
161+
</div>
162+
);
163+
};
164+
83165
const getDefaultCardProps = (
84166
trail: TrailType,
85167
discussionApiUrl: string,
@@ -121,6 +203,7 @@ const getDefaultCardProps = (
121203
isOnwardContent: true,
122204
onwardsSource: 'more-galleries',
123205
};
206+
124207
return defaultProps;
125208
};
126209

@@ -192,84 +275,3 @@ export const MoreGalleries = (props: Props) => {
192275
</div>
193276
);
194277
};
195-
196-
const MoreGalleriesSplashCard = ({
197-
defaultProps,
198-
}: {
199-
defaultProps: CardProps;
200-
}) => {
201-
const cardProps: Partial<CardProps> = {
202-
headlineSizes: {
203-
desktop: 'medium',
204-
tablet: 'medium',
205-
mobile: 'medium',
206-
},
207-
mediaPositionOnDesktop: 'right',
208-
mediaPositionOnMobile: 'top',
209-
mediaSize: 'medium',
210-
isOnwardSplash: true,
211-
};
212-
return (
213-
<div
214-
css={[
215-
cardsContainerStyles,
216-
css`
217-
margin-bottom: ${space[6]}px;
218-
background-color: ${palette(
219-
'--onward-more-galleries-card-background',
220-
)};
221-
padding: ${space[2]}px;
222-
${from.leftCol} {
223-
&::before {
224-
content: '';
225-
position: absolute;
226-
left: -11px;
227-
top: 8px;
228-
bottom: 0;
229-
width: 1px;
230-
background-color: ${palette(
231-
'--onward-content-border',
232-
)};
233-
}
234-
}
235-
`,
236-
]}
237-
>
238-
<Card {...defaultProps} {...cardProps} />
239-
</div>
240-
);
241-
};
242-
243-
const Title = ({ guardianBaseUrl }: { guardianBaseUrl: string }) => (
244-
<a
245-
css={css`
246-
${grid.column.centre}
247-
color: ${palette('--caption-text')};
248-
text-decoration: none;
249-
align-self: start;
250-
251-
${from.leftCol} {
252-
${grid.column.left}
253-
}
254-
`}
255-
href={`${guardianBaseUrl}/inpictures/all`}
256-
data-link-name="section heading"
257-
>
258-
<h2 css={headerStyles}>More galleries</h2>
259-
</a>
260-
);
261-
262-
const headerStyles = css`
263-
color: ${palette('--carousel-text')};
264-
${headlineBold24};
265-
padding-bottom: ${space[3]}px;
266-
padding-top: ${space[1]}px;
267-
268-
:hover {
269-
text-decoration: underline;
270-
}
271-
272-
${from.tablet} {
273-
${headlineBold28};
274-
}
275-
`;

0 commit comments

Comments
 (0)