Skip to content

Commit

Permalink
💄 Standardize h2 and h3 tags #1140
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandolucchesi committed Aug 31, 2022
1 parent bb98ed8 commit 1055db3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
const GLOBAL_PROD = ['global', 'secret', 'global-test']
const GLOBAL_DEV = ['global-development', 'global-test']
const NEWS = [...GLOBAL_PROD, 'japan', 'poland', 'brazil', 'germany', 'southkorea']
const NEWS = [...GLOBAL_DEV, ...GLOBAL_PROD, 'japan', 'poland', 'brazil', 'germany', 'southkorea']
const ARCHIVED_NEWS = [...GLOBAL_PROD, ...GLOBAL_DEV]
const NEWS_SUBSCRIPTION = [...GLOBAL_PROD, ...GLOBAL_DEV]
const MAGAZINE_SUBSCRIPTION = [...GLOBAL_DEV]
Expand Down
27 changes: 18 additions & 9 deletions web/pageComponents/shared/portableText/NewsText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { PortableText, PortableTextProps } from '@portabletext/react'
import { Text, List, Heading } from '@components'
import styled from 'styled-components'

import { Sub, Sup, ExternalLink, InternalLink, FigureWithLayout, Quote, Fact } from './components'
import { Sub, Sup, ExternalLink, InternalLink, FigureWithLayout, Quote, Fact, h2Heading, h3Heading } from './components'
import isEmpty from './helpers/isEmpty'
import type { PortableTextBlock } from '@portabletext/types'
import { Flags } from '../../../common/helpers/datasetHelpers'

const { Item } = List

Expand All @@ -21,18 +22,26 @@ const ContainerWithBottomSpace = styled(Container)`

const defaultSerializers = {
block: {
h2: ({ children }: PortableTextBlock) => (
h2: (props: PortableTextBlock) => (
<Container>
<Heading level="h2" size="lg">
<>{children}</>
</Heading>
{Flags.IS_DEV ? (
h2Heading(props)
) : (
<Heading level="h2" size="lg">
<>{props.children}</>
</Heading>
)}
</Container>
),
h3: ({ children }: PortableTextBlock) => (
h3: (props: PortableTextBlock) => (
<Container>
<Heading level="h3" size="md">
<>{children}</>
</Heading>
{Flags.IS_DEV ? (
h3Heading(props)
) : (
<Heading level="h3" size="md">
<>{props.children}</>
</Heading>
)}
</Container>
),
normal: ({ children }: PortableTextBlock) => {
Expand Down

0 comments on commit 1055db3

Please sign in to comment.