@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
3
3
import { PortableText } from '@portabletext/react' ;
4
4
import styled from 'styled-components' ;
5
5
6
- import { BodyLong , BodyShort , Detail , Heading , Label } from '@navikt/ds-react' ;
6
+ import { BodyLong , BodyShort , Detail , Heading , Ingress , Label } from '@navikt/ds-react' ;
7
7
8
8
import { useApp } from '../../../context/AppContext' ;
9
9
import { useSpråk } from '../../../context/SpråkContext' ;
@@ -47,10 +47,18 @@ export function TypografiWrapper({ typografi, style, children }: Props) {
47
47
) ;
48
48
case Typografi . HeadingH2 :
49
49
return (
50
- < Heading level = { '2' } size = { 'xsmall ' } spacing style = { style } >
50
+ < Heading level = { '2' } size = { 'medium ' } spacing style = { style } >
51
51
{ children }
52
52
</ Heading >
53
53
) ;
54
+ case Typografi . HeadingH3 :
55
+ return (
56
+ < Heading level = { '3' } size = { 'small' } spacing style = { style } >
57
+ { children }
58
+ </ Heading >
59
+ ) ;
60
+ case Typografi . Ingress :
61
+ return < Ingress style = { style } > { children } </ Ingress > ;
54
62
case Typografi . BodyLong :
55
63
return < StyledBodyLong style = { style } > { children } </ StyledBodyLong > ;
56
64
case Typografi . BodyShort :
@@ -72,23 +80,34 @@ const TekstBlock: React.FC<{
72
80
block : LocaleRecordBlock | undefined ;
73
81
flettefelter ?: FlettefeltVerdier ;
74
82
typografi ?: Typografi ;
75
- brukTypografiWrapper ?: boolean ;
76
- } > = ( { block, flettefelter, typografi, brukTypografiWrapper = true } ) => {
83
+ } > = ( { block, flettefelter, typografi } ) => {
77
84
const { valgtLocale } = useSpråk ( ) ;
78
85
const { flettefeltTilTekst } = useApp ( ) ;
79
86
80
87
return block ? (
81
88
< PortableText
82
89
value = { block [ valgtLocale ] }
83
90
components = { {
84
- block : ( { children } ) =>
85
- brukTypografiWrapper ? (
91
+ block : {
92
+ normal : ( { children } ) => (
86
93
< TypografiWrapper typografi = { typografi } style = { { minHeight : '1rem' } } >
87
94
{ children }
88
95
</ TypografiWrapper >
89
- ) : (
90
- children
91
96
) ,
97
+ h1 : ( { children } ) => (
98
+ < TypografiWrapper typografi = { typografi } > { children } </ TypografiWrapper >
99
+ ) ,
100
+ h2 : ( { children } ) => (
101
+ < TypografiWrapper typografi = { Typografi . HeadingH2 } >
102
+ { children }
103
+ </ TypografiWrapper >
104
+ ) ,
105
+ h3 : ( { children } ) => (
106
+ < TypografiWrapper typografi = { Typografi . HeadingH3 } >
107
+ { children }
108
+ </ TypografiWrapper >
109
+ ) ,
110
+ } ,
92
111
marks : {
93
112
flettefelt : props => {
94
113
if ( props ?. value ?. flettefeltVerdi ) {
0 commit comments