diff --git a/modules/ui/components/Folder.less b/modules/ui/components/Folder.less index bf681ead..7fa7a5a0 100644 --- a/modules/ui/components/Folder.less +++ b/modules/ui/components/Folder.less @@ -1,7 +1,4 @@ .root { - color: #eee; - font: 11px 'Lucida Grande', sans-serif; - background-color: #1a1a1a; } .title { diff --git a/modules/ui/components/Stack.jsx b/modules/ui/components/Stack.jsx new file mode 100644 index 00000000..9ef8655f --- /dev/null +++ b/modules/ui/components/Stack.jsx @@ -0,0 +1,15 @@ +import React from 'react'; + +import ls from './Stack.less' + +export default function Stack({children}) { + return
{children}
+} + +Window.defaultProps = { + type: 'neutral', +}; + + + + diff --git a/modules/ui/components/Stack.less b/modules/ui/components/Stack.less new file mode 100644 index 00000000..ac23969c --- /dev/null +++ b/modules/ui/components/Stack.less @@ -0,0 +1,9 @@ +@import '../styles/theme'; +@import '../styles/mixins'; + +.root > * { + + border-bottom: 1px solid @border-color; + padding: 0.3em 0.5em; + +} diff --git a/modules/ui/components/Window.jsx b/modules/ui/components/Window.jsx index b927b83c..7505950d 100644 --- a/modules/ui/components/Window.jsx +++ b/modules/ui/components/Window.jsx @@ -6,21 +6,23 @@ import Fa from "./Fa"; export default class Window extends React.Component { - constructor({initWidth}) { + constructor({initWidth, initLeft, initTop}) { super(); this.state = { - width: initWidth + width: initWidth, + left: initLeft, + top: initTop } } render() { - let {children, title, minimizable } = this.props; + let {children, title, minimizable, onClose} = this.props; return
-
- {title} +
+
{title.toUpperCase()}
{minimizable && _} - +
{children} @@ -30,10 +32,10 @@ export default class Window extends React.Component { getStyle() { return { - width: toPx(this.state.width), - height: toPx(this.state.height), - left: toPx(this.state.left), - top: toPx(this.state.top) + width: this.state.width, + height: this.state.height, + left: this.state.left, + top: this.state.top } } } @@ -42,7 +44,4 @@ Window.defaultProps = { minimizable: false, }; -function toPx(val) { - return val === undefined ? undefined : val + 'px'; -} diff --git a/modules/ui/components/Window.less b/modules/ui/components/Window.less index 4e5dcbdb..d7b43458 100644 --- a/modules/ui/components/Window.less +++ b/modules/ui/components/Window.less @@ -1,8 +1,24 @@ +@import '../styles/theme'; +@import '../styles/mixins'; + .root { position: absolute; + background-color: @bg-color-alt; } .bar { display: flex; + align-items: baseline; justify-content: space-between; + background-color: @bg-color; + line-height: 1; + cursor: default; + border-bottom: 1px solid @border-color; + padding-left: 0.5em; +} + +.button { + display: inline-block; + padding: 0.5em 0.5em 0.6em 0.5em; + .button-behavior(@color-danger); } diff --git a/modules/ui/components/controls/Button.jsx b/modules/ui/components/controls/Button.jsx index 97469a94..2b110bdf 100644 --- a/modules/ui/components/controls/Button.jsx +++ b/modules/ui/components/controls/Button.jsx @@ -2,8 +2,16 @@ import React from 'react'; import ls from './Button.less' -export default function Button({text}) { +export default function Button({text, type}) { - return {text} + return } + +Button.defaultProps = { + type: 'neutral', +}; + + + + diff --git a/modules/ui/components/controls/Button.less b/modules/ui/components/controls/Button.less index e69de29b..75286600 100644 --- a/modules/ui/components/controls/Button.less +++ b/modules/ui/components/controls/Button.less @@ -0,0 +1,18 @@ +@import '../../styles/theme'; +@import '../../styles/mixins'; + +.neutral, .accent, .danger { + background-color: darken(@color-neutral, 10%); +} + +.neutral { + .button-behavior(@color-neutral) +} + +.accent { + .button-behavior(@color-accent) +} + +.danger { + .button-behavior(@color-danger) +} \ No newline at end of file diff --git a/modules/ui/components/controls/ButtonGroup.jsx b/modules/ui/components/controls/ButtonGroup.jsx index c9435677..c0d4adff 100644 --- a/modules/ui/components/controls/ButtonGroup.jsx +++ b/modules/ui/components/controls/ButtonGroup.jsx @@ -4,6 +4,6 @@ import ls from './ButtonGroup.less' export default function ButtonGroup({children}) { - return
{children}
+ return
{children}
} diff --git a/modules/ui/components/controls/ButtonGroup.less b/modules/ui/components/controls/ButtonGroup.less index e69de29b..9f65ccb4 100644 --- a/modules/ui/components/controls/ButtonGroup.less +++ b/modules/ui/components/controls/ButtonGroup.less @@ -0,0 +1,8 @@ +.root { + display: flex; + justify-content: flex-end; + & > * { + margin-left: 0.5em; + } +} + diff --git a/modules/ui/components/controls/Field.jsx b/modules/ui/components/controls/Field.jsx index 4c1c8b3b..9561ce7e 100644 --- a/modules/ui/components/controls/Field.jsx +++ b/modules/ui/components/controls/Field.jsx @@ -1,12 +1,10 @@ import React from 'react'; -import ls from './Label.less' +import ls from './Field.less' export default function Field({children}) { - + return
- {children[0]} {children[1]} + {children}
; - - } diff --git a/modules/ui/components/controls/Field.less b/modules/ui/components/controls/Field.less index e69de29b..352f1da8 100644 --- a/modules/ui/components/controls/Field.less +++ b/modules/ui/components/controls/Field.less @@ -0,0 +1,5 @@ +.root { + display: flex; + justify-content: space-between; + align-items: baseline; +} \ No newline at end of file diff --git a/modules/ui/components/controls/InputControl.jsx b/modules/ui/components/controls/InputControl.jsx new file mode 100644 index 00000000..f235af07 --- /dev/null +++ b/modules/ui/components/controls/InputControl.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import ls from './InputControl.less' + +export default class InputControl extends React.Component { + + render() { + let {type, inputRef, ...props} = this.props; + + return
+ +
; + } +} + +InputControl.propTypes = { + type: PropTypes.oneOf(['number', 'text']), +}; + +InputControl.defaultProps = { + type: 'text' +}; \ No newline at end of file diff --git a/modules/ui/components/controls/InputControl.less b/modules/ui/components/controls/InputControl.less new file mode 100644 index 00000000..cc54ff2f --- /dev/null +++ b/modules/ui/components/controls/InputControl.less @@ -0,0 +1,20 @@ +@import '../../styles/theme'; + +.number input { + .colorStyling(@control-color-number, @control-bg); +} + +.text input { + .colorStyling(@control-color-text, @control-bg); +} + +.colorStyling(@color, @bg) { + color: @color; + background: @bg; + outline: none; + border: @bg 1px solid; + padding: 0.2em; + &:focus { + border: #444 1px solid; + } +} \ No newline at end of file diff --git a/modules/ui/components/controls/NumberControl.jsx b/modules/ui/components/controls/NumberControl.jsx index 097add1c..02d23145 100644 --- a/modules/ui/components/controls/NumberControl.jsx +++ b/modules/ui/components/controls/NumberControl.jsx @@ -1,19 +1,16 @@ import React from 'react'; import PropTypes from 'prop-types'; +import InputControl from './InputControl'; -import ls from './NumberControl.less' - -export default class NumberControl extends React.Component{ +export default class NumberControl extends React.Component { render() { - let {initValue, } = this.props; - - return
- this.input = input} - onWheel={this.onWheel} - onChange={e => onChange(e.target.value)} /> -
; + let {onChange, initValue} = this.props; + return onChange(e.target.value)} + inputRef={input => this.input = input} /> } onWheel = (e) => { diff --git a/modules/ui/components/controls/NumberControl.less b/modules/ui/components/controls/NumberControl.less deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/ui/components/controls/TextControl.jsx b/modules/ui/components/controls/TextControl.jsx new file mode 100644 index 00000000..56391cbc --- /dev/null +++ b/modules/ui/components/controls/TextControl.jsx @@ -0,0 +1,29 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import InputControl from './InputControl'; + +export default class TextControl extends React.Component { + + render() { + let {onChange, initValue} = this.props; + return onChange(e.target.value)} /> + } +} + +TextControl.propTypes = { + baseStep: PropTypes.number, + round: PropTypes.number, + min: PropTypes.number, + max: PropTypes.number, + accelerator: PropTypes.number, + initValue: PropTypes.number.isRequired, + onChange: PropTypes.func.isRequired +}; + +TextControl.defaultProps = { + baseStep: 1, + round: 0, + accelerator: 100 +}; \ No newline at end of file diff --git a/modules/ui/styles/init/main.less b/modules/ui/styles/init/main.less index 63527263..28df78f1 100644 --- a/modules/ui/styles/init/main.less +++ b/modules/ui/styles/init/main.less @@ -1,4 +1,5 @@ @import "../theme"; +@import "../mixins"; body { background-color: @bg-color; @@ -15,14 +16,16 @@ iframe { } :global(.disable-selection) { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; + .no-selection(); } :global(.compact-font) { font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, sans-serif; } +button { + border: 0; + background-color: inherit; + color: inherit; +} diff --git a/modules/ui/styles/mixins.less b/modules/ui/styles/mixins.less new file mode 100644 index 00000000..0a44320c --- /dev/null +++ b/modules/ui/styles/mixins.less @@ -0,0 +1,21 @@ + +.no-selection() { + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.button-behavior(@color) { + &:hover { + background-color: @color; + } + &:active { + background-color: darken(@color, 20%); + } +} + +.row() { + + border-bottom: 1px solid @border-color; +} \ No newline at end of file diff --git a/modules/ui/styles/theme.less b/modules/ui/styles/theme.less index 17fd8398..9901d6e8 100644 --- a/modules/ui/styles/theme.less +++ b/modules/ui/styles/theme.less @@ -9,12 +9,19 @@ @border-color: #2c2c2c; +@control-color-number: #2fa1d6; +@control-color-text: #9cdaf7; +@control-bg: #303030; + @work-area-color: #808080; @work-area-control-bar-bg-color: rgba(0, 0, 0, 0.5); @work-area-control-bar-bg-color-active: #555; @work-area-control-bar-font-color: @font-color-minor; +@color-danger: #b00; +@color-accent: #2B7D2B; +@color-neutral: #66727d; //@work-area-toolbar-bg-color: ; //@work-area-toolbar-font-color: ; diff --git a/web/app/cad/dom/components/ControlBar.less b/web/app/cad/dom/components/ControlBar.less index fe7564d6..44105949 100644 --- a/web/app/cad/dom/components/ControlBar.less +++ b/web/app/cad/dom/components/ControlBar.less @@ -14,7 +14,7 @@ .button { cursor: pointer; - padding: 0.4em 0.5em; + padding: 0.5em 0.5em 0.35em 0.5em; &:hover { background-color: @work-area-control-bar-bg-color-active; diff --git a/web/app/cad/dom/components/View3d.jsx b/web/app/cad/dom/components/View3d.jsx index 5263f62e..991c2ceb 100644 --- a/web/app/cad/dom/components/View3d.jsx +++ b/web/app/cad/dom/components/View3d.jsx @@ -14,6 +14,17 @@ import MenuHolder from "../menu/MenuHolder"; import {TOKENS as MENU_TOKENS} from '../menu/menuPlugin'; +import WindowSystem from 'ui/WindowSystem'; +import Window from "ui/components/Window"; +import Stack from "ui/components/Stack"; +import Field from "ui/components/controls/Field"; +import Label from "ui/components/controls/Label"; +import NumberControl from "ui/components/controls/NumberControl"; +import ButtonGroup from "ui/components/controls/ButtonGroup"; +import Button from "ui/components/controls/Button"; +import TextControl from './../../../../../modules/ui/components/controls/TextControl'; + + export default class View3d extends React.PureComponent { render() { @@ -35,6 +46,25 @@ export default class View3d extends React.PureComponent { + + + + + + + console.log(val)}/> + + + + console.log(val)}/> + + +
} diff --git a/web/app/cad/dom/components/WebApplication.jsx b/web/app/cad/dom/components/WebApplication.jsx index 52268df0..af6f7c54 100644 --- a/web/app/cad/dom/components/WebApplication.jsx +++ b/web/app/cad/dom/components/WebApplication.jsx @@ -7,15 +7,6 @@ import '../../../../css/app3d-legacy.less'; import View3d from './View3d'; -import WindowSystem from 'ui/WindowSystem'; -import Window from "ui/components/Window"; -import Folder from "ui/components/Folder"; -import Field from "ui/components/controls/Field"; -import Label from "ui/components/controls/Label"; -import NumberControl from "ui/components/controls/NumberControl"; -import ButtonGroup from "ui/components/controls/ButtonGroup"; -import Button from "ui/components/controls/Button"; - import ls from './WebApplication.less'; import TabSwitcher, {Tab} from 'ui/components/TabSwticher'; import Card from 'ui/components/Card'; @@ -54,23 +45,6 @@ export default class WebApplication extends React.Component { onSwitch={this.switchTab} />)} - {/* */} - {/**/} - {/**/} - {/**/} - {/**/} - {/* console.log(val)}/>*/} - {/**/} - {/**/} - {/**/} - {/* console.log(val)}/>*/} - {/**/} - {/**/} - {/*