Skip to content

Commit 9264f5f

Browse files
authored
Tag Page <p> styling (#14270)
* Add 4px padding at the bottom of <p> tags. * Add styling for strong, bold, and i tags * Prefer margin-bottom over padding bottom
1 parent 3aa3839 commit 9264f5f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

dotcom-rendering/src/components/TagPageHeader.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const titleContainerStyle = css`
191191
`;
192192

193193
const paragraphStyle = css`
194-
${headlineMedium17}
194+
${headlineMedium17};
195195
color: ${palette.neutral[46]};
196196
`;
197197

@@ -208,6 +208,19 @@ const linkStyles = css`
208208
border-bottom: 1px solid ${palette.brand[500]};
209209
`;
210210

211+
const pStyles = css`
212+
margin-bottom: ${space[1]}px;
213+
b,
214+
strong em,
215+
strong u {
216+
font-weight: bold;
217+
}
218+
219+
i {
220+
font-style: italic;
221+
}
222+
`;
223+
211224
const buildElementTree = (node: Node): ReactNode => {
212225
if (isElement(node)) {
213226
switch (node.nodeName) {
@@ -220,6 +233,11 @@ const buildElementTree = (node: Node): ReactNode => {
220233
});
221234
case 'BR':
222235
return jsx('br');
236+
case 'P':
237+
return jsx('p', {
238+
css: pStyles,
239+
children: Array.from(node.childNodes).map(buildElementTree),
240+
});
223241
default:
224242
return jsx(node.tagName.toLowerCase(), {
225243
children: Array.from(node.childNodes).map(buildElementTree),
@@ -278,7 +296,6 @@ export const TagPageHeader = ({ title, description, image }: Props) => {
278296
const descriptionFragment = description
279297
? parseHtml(description)
280298
: undefined;
281-
282299
return (
283300
<section css={[fallbackStyles, containerStyles]}>
284301
<div css={[decoration, sideBorders]} />

0 commit comments

Comments
 (0)