Skip to content

Commit 455a3cc

Browse files
committed
changes to support profiledb
1 parent 54cdc72 commit 455a3cc

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/tdb-documents-ui/src/documentationTemplates.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ import OverlayTrigger from 'react-bootstrap/OverlayTrigger'
66
import Tooltip from 'react-bootstrap/Tooltip'
77
import {FiHelpCircle} from "react-icons/fi"
88

9-
/**
9+
/** displays documentation for enum with @comment*/
10+
export function getEnumLabelDescription(item, documentation) {
11+
if(!documentation) return <div className="control-label">{item}</div>
12+
if(!documentation.hasOwnProperty(CONST.COMMENT)) return <div className="control-label">{item}</div>
13+
return <DisplayPropertyNameAndComment comment={documentation[CONST.COMMENT]} label={item}/>
14+
//return <small className="fst-italic text-muted">{documentation[CONST.COMMENT]}</small>
15+
}
16+
17+
/**
1018
*
1119
* @param {*} documentation - documentation object which contains labels and comments
1220
* @param {*} item - item
@@ -19,6 +27,7 @@ import {FiHelpCircle} from "react-icons/fi"
1927
"@values": values
2028
}
2129
if(!documentation) return enumDocumentation
30+
//if(typeof documentation === CONST.OBJECT_TYPE) return getEnumLabelDescription(item, documentation)
2231
if(!Array.isArray(documentation)) return enumDocumentation
2332
let valueArray=[]
2433
documentation.map(doc => {
@@ -51,9 +60,9 @@ import {FiHelpCircle} from "react-icons/fi"
5160
* @param {*} comment - documentation comment which will be displayed as a description tool tip in the UI
5261
* @returns
5362
*/
54-
function DisplayPropertyNameAndComment ({label, comment}){
63+
export function DisplayPropertyNameAndComment ({label, comment}){
5564
return <React.Fragment>
56-
<span id="tdb__property__name__label" className="h6">{label}</span>
65+
{label && <span id="tdb__property__name__label" className="h6">{label}</span>}
5766
{comment && <OverlayTrigger
5867
key={comment}
5968
placement={'right'}

0 commit comments

Comments
 (0)