@@ -3,7 +3,7 @@ import { HTMLAttributes, useContext } from 'react'
33import  {  useInView  }  from  'react-intersection-observer' 
44import  {  useDebounce  }  from  'react-use' 
55
6- import  {  buildShadow ,   buildTransition ,  Opacity ,  Spacing ,  Text ,  TextProps ,  useI18n  }  from  '@edgeandnode/gds' 
6+ import  {  buildTransition ,  Opacity ,  Spacing ,  Text ,  TextProps ,  useI18n  }  from  '@edgeandnode/gds' 
77
88import  {  LinkInline  }  from  '@/components' 
99import  {  DocumentContext  }  from  '@/layout/DocumentContext' 
@@ -12,8 +12,6 @@ export type HeadingProps = TextProps & {
1212  level : 1  |  2  |  3  |  4  |  5  |  6 
1313}  &  HTMLAttributes < HTMLHeadingElement > 
1414
15- export  type  HeadingSpecificProps  =  Omit < HeadingProps ,  'level'  |  'color' > 
16- 
1715const  BaseHeading  =  ( {  level,  id,  children,  ...props  } : HeadingProps )  =>  { 
1816  const  {  markOutlineItem }  =  useContext ( DocumentContext ) ! 
1917  const  {  ref,  inView : inOrAboveView  }  =  useInView ( { 
@@ -31,8 +29,8 @@ const BaseHeading = ({ level, id, children, ...props }: HeadingProps) => {
3129  const  {  t }  =  useI18n < any > ( ) 
3230
3331  return  ( 
34-     < Text  ref = { ref }  as = { `h${ level }  ` }  id = { id }  weight = "SEMIBOLD"  color = "White"  sx = { {   whiteSpace :  'nowrap'   } }   { ...props } > 
35-       < span   sx = { {   whiteSpace :  'normal'   } } > { children } </ span > 
32+     < Text  ref = { ref }  as = { `h${ level }  ` }  id = { id }  weight = "SEMIBOLD"  color = "White"  { ...props } > 
33+       { children } 
3634      { id  ? ( 
3735        < span 
3836          sx = { { 
@@ -42,6 +40,8 @@ const BaseHeading = ({ level, id, children, ...props }: HeadingProps) => {
4240            transition : buildTransition ( 'OPACITY' ) , 
4341          } } 
4442        > 
43+           { /* Non-breaking invisible space, to prevent a line break between the `#` and the previous word */ } 
44+           ⁠
4545          < LinkInline  href = { `#${ id }  ` } > 
4646            < span  aria-hidden = "true" > #</ span > 
4747            < VisuallyHidden . Root > { t ( 'global.linkToThisSection' ) } </ VisuallyHidden . Root > 
@@ -52,8 +52,10 @@ const BaseHeading = ({ level, id, children, ...props }: HeadingProps) => {
5252  ) 
5353} 
5454
55+ export  type  HeadingSpecificProps  =  Omit < HeadingProps ,  'level'  |  'color' > 
56+ 
5557const  H1  =  ( props : HeadingSpecificProps )  =>  { 
56-   return  < BaseHeading  level = { 1 }  size = "48px"  sx = { {  mb : Spacing [ '16px' ] ,   textShadow :  buildShadow ( 'L' )  } }  { ...props }  /> 
58+   return  < BaseHeading  level = { 1 }  size = "48px"  sx = { {  mb : Spacing [ '16px' ]  } }  { ...props }  /> 
5759} 
5860
5961const  H2  =  ( props : HeadingSpecificProps )  =>  { 
@@ -64,55 +66,26 @@ const H2 = (props: HeadingSpecificProps) => {
6466      sx = { { 
6567        mt : Spacing [ '48px' ] , 
6668        mb : Spacing [ '24px' ] , 
67-         textShadow : buildShadow ( 'M' ) , 
6869      } } 
6970      { ...props } 
7071    /> 
7172  ) 
7273} 
7374
7475const  H3  =  ( props : HeadingSpecificProps )  =>  { 
75-   return  ( 
76-     < BaseHeading 
77-       level = { 3 } 
78-       size = "24px" 
79-       sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '24px' ] ,  textShadow : buildShadow ( 'M' )  } } 
80-       { ...props } 
81-     /> 
82-   ) 
76+   return  < BaseHeading  level = { 3 }  size = "24px"  sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '24px' ]  } }  { ...props }  /> 
8377} 
8478
8579const  H4  =  ( props : HeadingSpecificProps )  =>  { 
86-   return  ( 
87-     < BaseHeading 
88-       level = { 4 } 
89-       size = "20px" 
90-       sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ] ,  textShadow : buildShadow ( 'S' )  } } 
91-       { ...props } 
92-     /> 
93-   ) 
80+   return  < BaseHeading  level = { 4 }  size = "20px"  sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ]  } }  { ...props }  /> 
9481} 
9582
9683const  H5  =  ( props : HeadingSpecificProps )  =>  { 
97-   return  ( 
98-     < BaseHeading 
99-       level = { 5 } 
100-       size = "18px" 
101-       sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ] ,  textShadow : buildShadow ( 'S' )  } } 
102-       { ...props } 
103-     /> 
104-   ) 
84+   return  < BaseHeading  level = { 5 }  size = "18px"  sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ]  } }  { ...props }  /> 
10585} 
10686
10787const  H6  =  ( props : HeadingSpecificProps )  =>  { 
108-   return  ( 
109-     < BaseHeading 
110-       level = { 6 } 
111-       size = "16px" 
112-       sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ] ,  textShadow : buildShadow ( 'S' )  } } 
113-       { ...props } 
114-     /> 
115-   ) 
88+   return  < BaseHeading  level = { 6 }  size = "16px"  sx = { {  mt : Spacing [ '32px' ] ,  mb : Spacing [ '16px' ]  } }  { ...props }  /> 
11689} 
11790
11891const  Heading  =  Object . assign ( { } ,  BaseHeading ,  { 
0 commit comments