File tree Expand file tree Collapse file tree 1 file changed +20
-21
lines changed Expand file tree Collapse file tree 1 file changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -43,40 +43,39 @@ import InfoBanner from "./InfoBanner"
43
43
/**
44
44
* Base HTML elements
45
45
*/
46
- const headingPropsForAnchor = ( id ?: string ) : HeadingProps =>
47
- id
48
- ? ( {
49
- scrollMarginTop : 28 ,
50
- id,
51
- "data-group" : true ,
52
- position : "relative" ,
53
- } as HeadingProps )
54
- : { }
46
+ const headingPropsForAnchor = ( id ?: string ) : HeadingProps => {
47
+ if ( ! id ) return { }
48
+ return {
49
+ scrollMarginTop : 28 ,
50
+ id,
51
+ "data-group" : true ,
52
+ position : "relative" ,
53
+ } as HeadingProps
54
+ }
55
55
56
56
export const commonHeadingProps = ( id ?: string ) : HeadingProps => ( {
57
57
fontWeight : 700 ,
58
58
lineHeight : 1.4 ,
59
59
...headingPropsForAnchor ( id ) ,
60
60
} )
61
61
62
- const IdAnchor : React . FC < { id ?: string } > = ( { id } ) =>
63
- id ? (
62
+ const IdAnchor : React . FC < { id ?: string } > = ( { id } ) => {
63
+ if ( ! id ) return null
64
+ return (
64
65
< Link
65
- href = { `# ${ id } ` }
66
+ href = { "#" + id }
66
67
position = "absolute"
67
68
insetInlineEnd = "100%"
68
69
aria-label = { id . replaceAll ( "-" , " " ) + " permalink" }
70
+ opacity = { 0 }
71
+ _groupHover = { { opacity : 1 } }
72
+ _focus = { { opacity : 1 } }
73
+ transition = "opacity 0.1s ease-in-out"
69
74
>
70
- < Icon
71
- as = { CiLink }
72
- opacity = { 0 }
73
- _groupHover = { { opacity : 1 } }
74
- transition = "opacity 0.1s ease-in-out"
75
- fontSize = "xl"
76
- me = { 1 }
77
- />
75
+ < Icon as = { CiLink } fontSize = "xl" me = "1" />
78
76
</ Link >
79
- ) : null
77
+ )
78
+ }
80
79
81
80
export const Heading1 = ( { children, ...rest } : HeadingProps ) => (
82
81
< OldHeading as = "h1" { ...commonHeadingProps ( ) } fontSize = "2.5rem" { ...rest } >
You can’t perform that action at this time.
0 commit comments