File tree Expand file tree Collapse file tree 5 files changed +45
-33
lines changed
apps/website/src/components Expand file tree Collapse file tree 5 files changed +45
-33
lines changed Original file line number Diff line number Diff line change
1
+ import type { ReactNode } from 'react' ;
2
+ import { Anchor } from './Anchor' ;
3
+
4
+ export interface CodeListingProps {
5
+ /**
6
+ * The value of this heading.
7
+ */
8
+ children : ReactNode ;
9
+ /**
10
+ * Additional class names to apply to the root element.
11
+ */
12
+ className ?: string | undefined ;
13
+ /**
14
+ * The href of this heading.
15
+ */
16
+ href ?: string | undefined ;
17
+ }
18
+
19
+ export function CodeHeading ( { href, className, children } : CodeListingProps ) {
20
+ return (
21
+ < div
22
+ className = { `flex flex-row flex-wrap place-items-center gap-1 break-all font-mono text-lg font-bold ${ className } ` }
23
+ >
24
+ { href ? < Anchor href = { href } /> : null }
25
+ { children }
26
+ </ div >
27
+ ) ;
28
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type {
5
5
ApiPropertySignature ,
6
6
} from '@microsoft/api-extractor-model' ;
7
7
import type { PropsWithChildren } from 'react' ;
8
- import { Anchor } from './Anchor ' ;
8
+ import { CodeHeading } from './CodeHeading ' ;
9
9
import { ExcerptText } from './ExcerptText' ;
10
10
import { InheritanceText } from './InheritanceText' ;
11
11
import { TSDoc } from './documentation/tsdoc/TSDoc' ;
@@ -55,21 +55,13 @@ export function Property({
55
55
) : null }
56
56
</ div >
57
57
) : null }
58
- < div className = "flex flex-row flex-wrap place-items-center gap-1" >
59
- < Anchor href = { `#${ item . displayName } ` } />
60
- < h4 className = "break-all font-mono text-lg font-bold" >
61
- { item . displayName }
62
- { item . isOptional ? '?' : '' }
63
- </ h4 >
58
+ < CodeHeading href = { `#${ item . displayName } ` } >
59
+ { `${ item . displayName } ${ item . isOptional ? '?' : '' } ` }
60
+ < span > { separator } </ span >
64
61
{ item . propertyTypeExcerpt . text ? (
65
- < >
66
- < h4 className = "font-mono text-lg font-bold" > { separator } </ h4 >
67
- < h4 className = "break-all font-mono text-lg font-bold" >
68
- < ExcerptText excerpt = { item . propertyTypeExcerpt } model = { item . getAssociatedModel ( ) ! } />
69
- </ h4 >
70
- </ >
62
+ < ExcerptText excerpt = { item . propertyTypeExcerpt } model = { item . getAssociatedModel ( ) ! } />
71
63
) : null }
72
- </ div >
64
+ </ CodeHeading >
73
65
</ div >
74
66
{ hasSummary || inheritedFrom ? (
75
67
< div className = "mb-4 flex flex-col gap-4" >
Original file line number Diff line number Diff line change 1
1
import type { ApiEnumMember } from '@microsoft/api-extractor-model' ;
2
- import { Anchor } from '../../Anchor' ;
3
- import { NameText } from '../../NameText' ;
4
2
import { SignatureText } from '../../SignatureText' ;
5
3
import { TSDoc } from '../../documentation/tsdoc/TSDoc' ;
4
+ import { CodeHeading } from '~/components/CodeHeading' ;
6
5
7
6
export function EnumMember ( { member } : { member : ApiEnumMember } ) {
8
7
return (
9
8
< div className = "flex flex-col scroll-mt-30" id = { member . displayName } >
10
- < div className = "flex flex-col gap-2 md:flex-row md:place-items-center md:-ml-8.5" >
11
- < Anchor href = { `#${ member . displayName } ` } />
12
- < NameText name = { member . name } />
13
- < h4 className = "font-bold" > =</ h4 >
9
+ < CodeHeading className = "md:-ml-8.5" href = { `#${ member . displayName } ` } >
10
+ { member . name }
11
+ < span > =</ span >
14
12
{ member . initializerExcerpt ? (
15
13
< SignatureText excerpt = { member . initializerExcerpt } model = { member . getAssociatedModel ( ) ! } />
16
14
) : null }
17
- </ div >
15
+ </ CodeHeading >
18
16
{ member . tsdocComment ? < TSDoc item = { member } tsdoc = { member . tsdocComment . summarySection } /> : null }
19
17
</ div >
20
18
) ;
Original file line number Diff line number Diff line change 1
1
import type { ApiMethod , ApiMethodSignature } from '@microsoft/api-extractor-model' ;
2
2
import { ApiItemKind } from '@microsoft/api-extractor-model' ;
3
3
import { useMemo } from 'react' ;
4
- import { Anchor } from '~/components/Anchor ' ;
4
+ import { CodeHeading } from '~/components/CodeHeading ' ;
5
5
import { ExcerptText } from '~/components/ExcerptText' ;
6
6
import { resolveParameters } from '~/util/model' ;
7
7
@@ -49,14 +49,11 @@ export function MethodHeader({ method }: { method: ApiMethod | ApiMethodSignatur
49
49
) : null }
50
50
</ div >
51
51
) : null }
52
- < div className = "flex flex-row flex-wrap place-items-center gap-1" >
53
- < Anchor href = { `#${ key } ` } />
54
- < h4 className = "break-all font-mono text-lg font-bold" > { getShorthandName ( method ) } </ h4 >
55
- < h4 className = "font-mono text-lg font-bold" > :</ h4 >
56
- < h4 className = "break-all font-mono text-lg font-bold" >
57
- < ExcerptText excerpt = { method . returnTypeExcerpt } model = { method . getAssociatedModel ( ) ! } />
58
- </ h4 >
59
- </ div >
52
+ < CodeHeading href = { `#${ key } ` } >
53
+ { getShorthandName ( method ) }
54
+ < span > :</ span >
55
+ < ExcerptText excerpt = { method . returnTypeExcerpt } model = { method . getAssociatedModel ( ) ! } />
56
+ </ CodeHeading >
60
57
</ div >
61
58
</ div >
62
59
) ;
You can’t perform that action at this time.
0 commit comments