Skip to content

Commit ba5a1db

Browse files
author
rodriguez-facundo
committed
#136 Css and styling
1 parent 96f60ba commit ba5a1db

3 files changed

Lines changed: 73 additions & 36 deletions

File tree

webapp/components/layout/LayoutManager.js

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import WidgetFactory from './WidgetFactory';
99
import TabsetIconFactory from './TabsetIconFactory'
1010
import defaultLayoutConfiguration from './layoutConf.json';
1111
import simulateLayoutConfiguration from './simulateLayoutConf.json';
12+
import Icon from '@material-ui/core/Icon';
13+
14+
import { withStyles } from '@material-ui/core/styles'
15+
1216

1317
/**
1418
* Transforms a widget configutation into a flexlayout node descriptor
@@ -29,7 +33,20 @@ function widget2Node (configuration) {
2933
};
3034
}
3135

32-
export default class LayoutManager extends Component {
36+
const styles = ({ spacing }) => ({
37+
container: {
38+
position: 'relative',
39+
flexGrow: 1,
40+
display: 'flex',
41+
flexDirection: 'row',
42+
alignItems: 'stretch'
43+
},
44+
spacer: { width: spacing(1) },
45+
flexlayout: { position: 'relative', flexGrow: 1 }
46+
})
47+
48+
49+
class LayoutManager extends Component {
3350

3451
constructor (props) {
3552
super(props);
@@ -256,31 +273,31 @@ export default class LayoutManager extends Component {
256273
model.doAction(FlexLayout.Actions.moveNode(node.getId(), 'bottomPanel', FlexLayout.DockLocation.CENTER, 0));
257274
}
258275

259-
onRenderTabSet (panel, renderValues) {
260-
const model = this.getModel()
261-
if (panel.getType() === "tabset") {
262-
if (panel.getId() != 'leftPanel' && panel.getChildren().length > 0){
263-
renderValues.buttons.push(<div key={panel.getId()} className="fa fa-window-minimize customIconFlexLayout" onClick={() => {
264-
model.doAction(FlexLayout.Actions.moveNode(panel.getSelectedNode().getId(), "border_bottom", FlexLayout.DockLocation.CENTER, 0));
265-
}} />);
266-
}
267-
}
276+
onRenderTab (node,renderValues) {
277+
renderValues.leading = <Icon className={node.getConfig().icon}/>
268278
}
269279
render () {
270-
280+
const { classes } = this.props
271281
return (
272-
<div style={{ position: 'relative', flexGrow: 1 }}>
273-
<FlexLayout.Layout
274-
ref="layout"
275-
model={this.getModel()}
276-
factory={this.factory.bind(this)}
277-
iconFactory={this.iconFactory.bind(this)}
278-
onAction={action => this.onAction(action)}
279-
clickOnBordersAction={node => this.clickOnBordersAction(node)}
280-
onRenderTabSet={(node, renderValues) => this.onRenderTabSet(node, renderValues)}
281-
/>
282-
282+
<div className={classes.container}>
283+
<div className={classes.spacer}/>
284+
<div className={classes.flexlayout}>
285+
<FlexLayout.Layout
286+
ref="layout"
287+
model={this.getModel()}
288+
factory={this.factory.bind(this)}
289+
iconFactory={this.iconFactory.bind(this)}
290+
onAction={action => this.onAction(action)}
291+
clickOnBordersAction={node => this.clickOnBordersAction(node)}
292+
onRenderTab={(node,renderValues) => this.onRenderTab(node,renderValues)}
293+
/>
294+
</div>
295+
296+
<div className={classes.spacer}/>
283297
</div>
284298
)
285299
}
286-
}
300+
}
301+
302+
303+
export default withStyles(styles)(LayoutManager)

webapp/components/settings/Drawer.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,10 @@ import {
2424
const drawerOpenWidth = 200;
2525
const drawerCloseWidth = 54;
2626

27-
const createTransition = (entering, transitions) => (
28-
transitions.create('width', {
29-
easing: transitions.easing.sharp,
30-
duration: entering ? transitions.duration.enteringScreen : transitions.duration.leavingScreen,
31-
})
32-
)
33-
3427
const drawerCss = (entering, transitions, palette) => ({
3528
overflow: 'hidden',
3629
width: props => props.width,
3730
flexShrink: 0,
38-
backgroundColor: props => props.dark ? palette.grey[900] : palette.grey[800],
3931
borderRight: 'none',
4032
transition: transitions.create('width', {
4133
easing: transitions.easing.sharp,
@@ -47,7 +39,7 @@ const useStyles = makeStyles(({ transitions, palette }) => ({
4739
openDrawer: drawerCss(true, transitions, palette),
4840

4941
closeDrawer: drawerCss(false, transitions, palette),
50-
42+
5143
colapse: {
5244
color: 'white',
5345
position: 'absolute',
@@ -64,7 +56,7 @@ const useStyles = makeStyles(({ transitions, palette }) => ({
6456
export default ({ widgets, newWidget, editMode }) => {
6557
const [expand, setExpand] = useState({ dark: !editMode })
6658

67-
const classes = useStyles({ dark: !editMode, width: expand ? drawerOpenWidth : drawerCloseWidth });
59+
const classes = useStyles({ width: expand ? drawerOpenWidth : drawerCloseWidth });
6860

6961
function createWidget (widgetId) {
7062
if (!widgets[widgetId]) {
@@ -116,7 +108,11 @@ export default ({ widgets, newWidget, editMode }) => {
116108

117109
<IconButton
118110
className={classes.colapse}
119-
onClick={() => setExpand(!expand)}
111+
onClick={() => {
112+
setExpand(!expand)
113+
setTimeout(() => window.dispatchEvent(new Event('resize')), 400)
114+
// pepe()
115+
}}
120116
>
121117
{expand ? <ChevronLeftIcon/> : <ChevronRightIcon/>}
122118
</IconButton>
@@ -129,3 +125,20 @@ export default ({ widgets, newWidget, editMode }) => {
129125
)
130126

131127
}
128+
129+
const pepe = () => {
130+
window.expansionTransit = {
131+
timer: setInterval(() => {
132+
window.dispatchEvent(new Event('resize'))
133+
console.log(window.expansionTransit.count)
134+
if (window.expansionTransit.count > 0) {
135+
window.expansionTransit.count -= 1
136+
} else {
137+
clearInterval(window.expansionTransit.timer)
138+
console.log('clear')
139+
}
140+
141+
}, 150),
142+
count: 1
143+
}
144+
}

webapp/css/flexlayout.less

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
@bring-front: 1000;
3535

3636
.flexlayout__layout {
37+
border-left: none!important;
38+
border-right: none!important;
3739
background-color: @color-dark;//color-light
3840
top: 0px;
3941
margin-top: @gutter / 2;
@@ -96,7 +98,7 @@
9698
border-top-left-radius: @panelradius;
9799
color: @color-white;
98100
display: flex;
99-
align-items: center;
101+
align-items: flex-end;
100102
margin-right: @tab-spacing;
101103
.flexlayout__tab_button_content {
102104
color: @secondary_color;
@@ -109,7 +111,7 @@
109111
border-top-right-radius: @panelradius;
110112
border-top-left-radius: @panelradius;
111113
display: flex;
112-
align-items: center;
114+
align-items: flex-end;
113115
}
114116

115117
.flexlayout__border_bottom {
@@ -150,6 +152,11 @@
150152
margin-left: @spacing;
151153
}
152154

155+
.flexlayout__tab_button_trailing {
156+
display: flex;
157+
align-items: center;
158+
}
159+
153160
// Thin white tab icons
154161
.flexlayout__border_button_trailing,
155162
.flexlayout__tab_button_trailing,

0 commit comments

Comments
 (0)