From 0fc47fefcb72592bd34e238949db9e98a84b8a63 Mon Sep 17 00:00:00 2001 From: geireann Date: Mon, 5 Jun 2023 19:42:06 -0400 Subject: topbar, buttons etc --- src/client/views/nodes/DocumentView.scss | 5 +- src/client/views/nodes/DocumentView.tsx | 2 +- src/client/views/nodes/button/FontIconBox.tsx | 39 ++++++++--- .../nodes/button/colorDropdown/ColorDropdown.tsx | 77 ---------------------- .../views/nodes/button/colorDropdown/index.ts | 1 - 5 files changed, 35 insertions(+), 89 deletions(-) delete mode 100644 src/client/views/nodes/button/colorDropdown/ColorDropdown.tsx delete mode 100644 src/client/views/nodes/button/colorDropdown/index.ts (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/DocumentView.scss b/src/client/views/nodes/DocumentView.scss index 1265651ad..cfad67912 100644 --- a/src/client/views/nodes/DocumentView.scss +++ b/src/client/views/nodes/DocumentView.scss @@ -115,7 +115,10 @@ width: 100%; height: 100%; transition: inherit; - + display: flex; + justify-content: center; + align-items: center; + .sharingIndicator { height: 30px; width: 30px; diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index cc105326f..a94d6f71d 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1211,7 +1211,7 @@ export class DocumentViewInternal extends DocComponent() { {this.label} ); + + return ( + { + this.colorPickerClosed = !this.colorPickerClosed; + this.noTooltip = !this.colorPickerClosed; + setTimeout(() => Doc.UnBrushAllDocs()); + e.stopPropagation(); + }}/> + ) return (
() {
); + return ( + + ) + if (switchToggle) { return (
@@ -479,6 +493,11 @@ export class FontIconBox extends DocComponent() { @computed get defaultButton() { const color = this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Color); const backgroundColor = this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.BackgroundColor); + + return ( + + ) + return (
@@ -547,18 +566,20 @@ export class FontIconBox extends DocComponent() { break; case ButtonType.ClickButton: case ButtonType.ToolButton: button = ( -
- {this.Icon(color)} - {label()} -
+ + //
+ // {this.Icon(color)} + // {label()} + //
); break; case ButtonType.MenuButton: button = ( -
- {this.Icon(color)} - {label(true)} - -
+ + //
+ // {this.Icon(color)} + // {label(true)} + // + //
); break; } diff --git a/src/client/views/nodes/button/colorDropdown/ColorDropdown.tsx b/src/client/views/nodes/button/colorDropdown/ColorDropdown.tsx deleted file mode 100644 index 74c3c563c..000000000 --- a/src/client/views/nodes/button/colorDropdown/ColorDropdown.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import React, { Component } from 'react'; -import { BoolCast, StrCast } from '../../../../../fields/Types'; -import { IButtonProps } from '../ButtonInterface'; -import { ColorState, SketchPicker } from 'react-color'; -import { ScriptField } from '../../../../../fields/ScriptField'; -import { Doc } from '../../../../../fields/Doc'; -import { FontIconBox } from '../FontIconBox'; - -export class ColorDropdown extends Component { - render() { - const active: string = StrCast(this.props.rootDoc.dropDownOpen); - - const script: string = StrCast(this.props.rootDoc.script); - const scriptCheck: string = script + '(undefined, true)'; - const boolResult = ScriptField.MakeScript(scriptCheck)?.script.run().result; - - const stroke: boolean = false; - // if (script === "setStrokeColor") { - // stroke = true; - // const checkWidth = ScriptField.MakeScript("setStrokeWidth(0, true)")?.script.run().result; - // const width = 20 + (checkWidth / 100) * 70; - // const height = 20 + (checkWidth / 100) * 70; - // strokeIcon = (
); - // } - - const colorOptions: string[] = ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF', '#f1efeb']; - - const colorBox = (func: (color: ColorState) => void) => ; - const label = - !this.props.label || !FontIconBox.GetShowLabels() ? null : ( -
- {this.props.label} -
- ); - - const dropdownCaret = ( -
- -
- ); - - const click = (value: ColorState) => { - const hex: string = value.hex; - const s = ScriptField.MakeScript(script + '("' + hex + '", false)'); - if (s) { - s.script.run().result; - } - }; - return ( -
(this.props.rootDoc.dropDownOpen = !this.props.rootDoc.dropDownOpen)} - onPointerDown={e => e.stopPropagation()}> - -
- {label} - {/* {dropdownCaret} */} - {this.props.rootDoc.dropDownOpen ? ( -
-
e.stopPropagation()} onClick={e => e.stopPropagation()}> - {colorBox(click)} -
-
{ - e.stopPropagation(); - this.props.rootDoc.dropDownOpen = false; - }} - /> -
- ) : null} -
- ); - } -} diff --git a/src/client/views/nodes/button/colorDropdown/index.ts b/src/client/views/nodes/button/colorDropdown/index.ts deleted file mode 100644 index 1147d6457..000000000 --- a/src/client/views/nodes/button/colorDropdown/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ColorDropdown'; \ No newline at end of file -- cgit v1.2.3-70-g09d2