@@ -9,6 +9,7 @@ import { Markdown } from '~/ui/components/Markdown'
9
9
import { Missing } from '~/ui/components/Missing'
10
10
import { createModal } from '~/ui/components/Modals'
11
11
import { RichText } from '~/ui/components/RichText'
12
+ import { SectionHeader } from '~/ui/components/SectionHeader'
12
13
import { SourceLink } from '~/ui/components/SourceLink'
13
14
import { TypeDocInterface } from '~/ui/components/TypeDocInterface'
14
15
import { TypeDocType } from '~/ui/components/TypeDocType'
@@ -45,6 +46,7 @@ export const useTypesModal = createModal<TypesModalProps>(
45
46
generateTypeUsage ( type . name ) ,
46
47
[ type ]
47
48
)
49
+ const scope = type && typeIdStr ( type . name , type . id )
48
50
49
51
return (
50
52
< InlineTypeContext . Provider
@@ -117,27 +119,25 @@ export const useTypesModal = createModal<TypesModalProps>(
117
119
usage = { usage . usage }
118
120
usageTabs = { usage . usageTabs }
119
121
header = "h3"
120
- scope = { typeIdStr ( type . name , type . id ) }
122
+ scope = { scope }
121
123
/>
122
124
) }
123
125
124
126
{ type . type && (
125
127
< section >
126
- < h3 > Type</ h3 >
127
-
128
+ < SectionHeader header = "Type" scope = { scope } tag = "h3" />
128
129
< Code value = { < TypeDocType type = { type . type } /> } />
129
130
</ section >
130
131
) }
131
132
132
133
{ type . typeParameters && (
133
134
< section >
134
- < h3 > Generics</ h3 >
135
-
135
+ < SectionHeader header = "Generics" scope = { scope } tag = "h3" />
136
136
< TypeDocInterface list = { type . typeParameters } />
137
137
</ section >
138
138
) }
139
139
140
- < TypeContent type = { type } />
140
+ < TypeContent type = { type } scope = { scope } />
141
141
</ RichText >
142
142
143
143
< code >
@@ -159,17 +159,17 @@ export const useTypesModal = createModal<TypesModalProps>(
159
159
160
160
interface ContentProps {
161
161
type : DeclarationReflection
162
+ scope : string | undefined
162
163
}
163
164
164
- function TypeContent ( { type } : ContentProps ) {
165
+ function TypeContent ( { type, scope } : ContentProps ) {
165
166
switch ( type . kindString ) {
166
167
case 'Interface' :
167
168
if ( ! type . children ?. length ) return null
168
169
169
170
return (
170
171
< div >
171
- < h3 > Interface</ h3 >
172
-
172
+ < SectionHeader header = "Interface" scope = { scope } tag = "h3" />
173
173
< TypeDocInterface list = { type . children } />
174
174
</ div >
175
175
)
@@ -179,8 +179,7 @@ function TypeContent({ type }: ContentProps) {
179
179
< div >
180
180
{ type . default && (
181
181
< div >
182
- < h3 > Default type</ h3 >
183
-
182
+ < SectionHeader header = "Default type" scope = { scope } tag = "h3" />
184
183
< Code value = { < TypeDocType type = { type . default } /> } />
185
184
</ div >
186
185
) }
0 commit comments