forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
51 lines (46 loc) · 1.18 KB
/
index.tsx
File metadata and controls
51 lines (46 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { ArrowTurnDownLeftIcon } from '@heroicons/react/24/outline';
import classNames from 'classnames';
import type Signature from '#ui/Common/Signature';
import type { ComponentProps, FC } from 'react';
import styles from './index.module.css';
type SignatureHeaderProps = { isReturn?: boolean } & Omit<
ComponentProps<typeof Signature>,
'title' | 'description'
>;
const SignatureHeader: FC<SignatureHeaderProps> = ({
name,
type,
optional,
isReturn = false,
}) => (
<div className={styles.header}>
{name && (
<span
className={classNames(styles.attribute, {
[styles.return]: isReturn,
})}
>
{isReturn && <ArrowTurnDownLeftIcon />}
<span
className={classNames({
[styles.longName]: name.length > 16,
})}
>
{name}:
{optional && (
<span
role="img"
aria-label="Optional"
data-tooltip="Optional"
tabIndex={0}
>
?
</span>
)}
</span>
</span>
)}
{type && <span className={styles.type}>{type}</span>}
</div>
);
export default SignatureHeader;