Skip to content

Commit

Permalink
add missing PropLabel.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Jun 14, 2024
1 parent d11dbe0 commit 32ec824
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions grebi_ui/src/pages/node/prop_table/PropLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

import React, { Fragment } from "react";
import Refs from "../../../model/Refs";
import { pickBestDisplayName } from "../../../app/util";
import { Tooltip } from "@mui/material";

export default function PropLabel(params:{prop:string,refs:Refs}) {

let { prop, refs } = params

let ref = refs.get(prop)

let displayName:string|undefined = ({
'grebi:name': 'Name',
'grebi:synonym': 'Synonym',
'grebi:description': 'Description',
'grebi:type': 'Type',
})[prop]

if(displayName) {
return <b>{displayName}</b>
}

if(ref) {
displayName = pickBestDisplayName(ref.name)
if(displayName) {
return <b>{displayName}
<Tooltip
title={ref.id.join('; ')}
placement="top"
arrow
>
<i className="icon icon-common icon-info text-neutral-default text-sm ml-1" style={{cursor:'pointer'}} />
</Tooltip>
</b>
}
}

return <b style={{fontFamily:"'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace"}}>
{prop}
</b>
}

0 comments on commit 32ec824

Please sign in to comment.