Skip to content
Snippets Groups Projects
Commit c55b0224 authored by Tarje Lavik's avatar Tarje Lavik
Browse files

Add header sizing

parent b7956213
No related branches found
No related tags found
No related merge requests found
...@@ -19,13 +19,23 @@ export default function PortableTextBlock(props) { ...@@ -19,13 +19,23 @@ export default function PortableTextBlock(props) {
...rest ...rest
} = props } = props
const getFontSize = (level) => {
switch(level) {
case "h2" :
return {base: "lg", sm: "2xl", md: "3xl", xl: "4xl"}
case "h3" :
return {base: "md", sm: "xl", md: "2xl", xl: "3xl"}
default : return null
}
}
const BlockRenderer = (props) => { const BlockRenderer = (props) => {
if(!props) {return null} if(!props) {return null}
const {style = 'normal'} = props.node const {style = 'normal'} = props.node
if (/^h\d/.test(style)) { if (/^h\d/.test(style)) {
const level = style const level = style
return(<Heading as={level} fontSize={fontSize}>{props.children}</Heading>) return(<Heading as={level} fontSize={getFontSize(level)}>{props.children}</Heading>)
} }
if (style === 'blockquote') { if (style === 'blockquote') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment