diff options
| author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-08-03 10:21:23 -0500 |
|---|---|---|
| committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-08-03 10:21:23 -0500 |
| commit | 23591a0dec82ca7c0fcb3a09c617c031dd2a9218 (patch) | |
| tree | 0094e57c0a67c09742434cc538ace95eccf56dfa /src/client/views/nodes/FontIconBox.tsx | |
| parent | f4940b063a512e15723d62671b8e11619b1bfcd7 (diff) | |
| parent | 9d2204b09a88315f4bb294dce3043a87e14ae45f (diff) | |
merge
Diffstat (limited to 'src/client/views/nodes/FontIconBox.tsx')
| -rw-r--r-- | src/client/views/nodes/FontIconBox.tsx | 61 |
1 files changed, 16 insertions, 45 deletions
diff --git a/src/client/views/nodes/FontIconBox.tsx b/src/client/views/nodes/FontIconBox.tsx index 48f9d7cc6..2f540e62a 100644 --- a/src/client/views/nodes/FontIconBox.tsx +++ b/src/client/views/nodes/FontIconBox.tsx @@ -12,8 +12,6 @@ import { Doc } from '../../../fields/Doc'; import { ContextMenu } from '../ContextMenu'; import { ScriptField } from '../../../fields/ScriptField'; import { Tooltip } from '@material-ui/core'; -import { createUnionOrIntersectionTypeNode } from 'typescript'; -import { CurrentUserUtils } from '../../util/CurrentUserUtils'; const FontIconSchema = createSchema({ icon: "string", }); @@ -61,49 +59,22 @@ export class FontIconBox extends DocComponent<FieldViewProps, FontIconDocument>( } render() { - - //style={{ backgroundColor: this.props.backgroundColor?.(this.props.Document) }}> - - if (this.layoutDoc.menuIcon) { - - // let backgroundColor = "black"; - // if (this.dataDoc.title === "Sharing" || this.dataDoc.title === "Help" || this.dataDoc.title === "Settings" || this.dataDoc.title === "Import") { - // backgroundColor = "black"; - // } else { - // backgroundColor = CurrentUserUtils.selectedPanel === this.dataDoc.title ? "lightgrey" : ""; - // } - - const color = CurrentUserUtils.selectedPanel === this.dataDoc.title ? "black" : "white"; - const menuBTN = <div className="menuButton" - onDoubleClick={emptyFunction} - style={{ backgroundColor: CurrentUserUtils.selectedPanel === this.dataDoc.title ? "lightgrey" : "" }}> - - <div className="menuButton-wrap" - style={{ backgroundColor: CurrentUserUtils.selectedPanel === this.dataDoc.title ? "lightgrey" : "" }}> - <FontAwesomeIcon className="menuButton-icon" - icon={StrCast(this.dataDoc.icon, "user") as any} color={color} size="lg" /> - <div className="menuButton-label" style={{ color: color }}> {this.dataDoc.title} </div> + const label = StrCast(this.rootDoc.label, StrCast(this.rootDoc.title)); + const color = StrCast(this.layoutDoc.color, this._foregroundColor); + const backgroundColor = StrCast(this.layoutDoc._backgroundColor, StrCast(this.rootDoc.backgroundColor, this.props.backgroundColor?.(this.rootDoc))); + const shape = StrCast(this.layoutDoc.iconShape, "round"); + const button = <> + <button className={`menuButton-${shape}`} ref={this._ref} onContextMenu={this.specificContextMenu} + style={{ boxShadow: this.layoutDoc.ischecked ? `4px 4px 12px black` : undefined, backgroundColor }}> + <div className="menuButton-wrap"> + {<FontAwesomeIcon className={`menuButton-icon-${shape}`} icon={StrCast(this.dataDoc.icon, "user") as any} color={color} size="lg" />} + {!label ? (null) : <div className="fontIconBox-label" style={{ color, backgroundColor }}> {label} </div>} </div> - </div>; - - return menuBTN; - } else { - const referenceDoc = (this.layoutDoc.dragFactory instanceof Doc ? this.layoutDoc.dragFactory : this.layoutDoc); - const refLayout = Doc.Layout(referenceDoc); - const button = <button className="fontIconBox-outerDiv" ref={this._ref} onContextMenu={this.specificContextMenu} - style={{ - padding: Cast(this.layoutDoc._xPadding, "number", null), - background: StrCast(refLayout._backgroundColor, StrCast(refLayout.backgroundColor)), - boxShadow: this.layoutDoc.ischecked ? `4px 4px 12px black` : undefined - }}> - <FontAwesomeIcon className="fontIconBox-icon" icon={StrCast(this.dataDoc.icon, "user") as any} color={StrCast(this.layoutDoc.color, this._foregroundColor)} size="sm" /> - {!this.rootDoc.title ? (null) : <div className="fontIconBox-label" style={{ width: this.rootDoc.label ? "max-content" : undefined }}> {StrCast(this.rootDoc.label, StrCast(this.rootDoc.title).substring(0, 6))} </div>} - </button>; - return !this.layoutDoc.toolTip ? button : - <Tooltip title={<div className="dash-tooltip">{StrCast(this.layoutDoc.toolTip)}</div>}> - {button} - </Tooltip>; - } - + </button> + </>; + return !this.layoutDoc.toolTip ? button : + <Tooltip title={<div className="dash-tooltip">{StrCast(this.layoutDoc.toolTip)}</div>}> + {button} + </Tooltip>; } }
\ No newline at end of file |
