Skip to content

Commit 32ec824

Browse files
committed
add missing PropLabel.tsx
1 parent d11dbe0 commit 32ec824

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
import React, { Fragment } from "react";
3+
import Refs from "../../../model/Refs";
4+
import { pickBestDisplayName } from "../../../app/util";
5+
import { Tooltip } from "@mui/material";
6+
7+
export default function PropLabel(params:{prop:string,refs:Refs}) {
8+
9+
let { prop, refs } = params
10+
11+
let ref = refs.get(prop)
12+
13+
let displayName:string|undefined = ({
14+
'grebi:name': 'Name',
15+
'grebi:synonym': 'Synonym',
16+
'grebi:description': 'Description',
17+
'grebi:type': 'Type',
18+
})[prop]
19+
20+
if(displayName) {
21+
return <b>{displayName}</b>
22+
}
23+
24+
if(ref) {
25+
displayName = pickBestDisplayName(ref.name)
26+
if(displayName) {
27+
return <b>{displayName}
28+
<Tooltip
29+
title={ref.id.join('; ')}
30+
placement="top"
31+
arrow
32+
>
33+
<i className="icon icon-common icon-info text-neutral-default text-sm ml-1" style={{cursor:'pointer'}} />
34+
</Tooltip>
35+
</b>
36+
}
37+
}
38+
39+
return <b style={{fontFamily:"'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace"}}>
40+
{prop}
41+
</b>
42+
}

0 commit comments

Comments
 (0)