diff --git a/modules/ui/components/Section.jsx b/modules/ui/components/Section.jsx new file mode 100644 index 00000000..0f3e66f0 --- /dev/null +++ b/modules/ui/components/Section.jsx @@ -0,0 +1,47 @@ +import React from 'react'; +import ls from './Section.less'; +import Fa from './Fa'; + +export const TabContext = React.createContext(0); + +export class Section extends React.PureComponent { + + constructor({defaultClosed}) { + super(); + this.state = { + closed: defaultClosed + } + } + + render() { + let {label, closable, children} = this.props; + let closed = this.isClosed(); + return + { + tabs =>
+ +
+ + + + {label} +
+ {!closed && children} +
+
+ } +
; + } + + isClosed() { + let {closable} = this.props; + if (!closable) return false; + return closable && this.state.closed; + } + + tweakClose = () => { + this.setState({closed: !this.isClosed()}); + } +} + + diff --git a/modules/ui/components/Section.less b/modules/ui/components/Section.less new file mode 100644 index 00000000..c588ec8f --- /dev/null +++ b/modules/ui/components/Section.less @@ -0,0 +1,16 @@ + +.section { +} + +.header { + +} + +.handle { + +} + +.label { + +} + diff --git a/web/app/cad/dom/components/ObjectExplorer.jsx b/web/app/cad/dom/components/ObjectExplorer.jsx index 9bf2ded7..f01e2e4f 100644 --- a/web/app/cad/dom/components/ObjectExplorer.jsx +++ b/web/app/cad/dom/components/ObjectExplorer.jsx @@ -1,10 +1,28 @@ import React from 'react'; +import connect from '../../../../../modules/ui/connect'; +import {Section} from '../../../../../modules/ui/components/Section'; +import {MShell} from '../../model/mshell'; -export default class ObjectExplorer extends React.Component { +export default connect(streams => streams.craft.models.map(models => ({models}))) +(function ObjectExplorer({models}) { - render() { - return
- ObjectExplorer -
- } -} \ No newline at end of file + return models.map(m =>
+
+ { + m.faces.map(f =>
+
+ {f.sketchObjects.map(o =>
{o.id + ':' + o.sketchPrimitive.constructor.name}
)} +
+
) + } +
+
+ { + m.faces.map(e =>
+
) + } +
+ +
); + +});