From 8d3bff49919c566380a5194a633fd76cfafc2cff Mon Sep 17 00:00:00 2001 From: David Ballester Mena Date: Sat, 2 Nov 2019 19:29:55 +0100 Subject: [PATCH] feat(graph): improve small layout --- src/components/navbar/navbar.component.js | 7 +++-- .../graph/components/graph-large.component.js | 7 ++++- .../graph/components/graph-small.component.js | 30 +++++++++++++------ src/scenes/graph/graph.component.js | 9 ++---- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/components/navbar/navbar.component.js b/src/components/navbar/navbar.component.js index 0bd7e71..794e8fd 100644 --- a/src/components/navbar/navbar.component.js +++ b/src/components/navbar/navbar.component.js @@ -13,10 +13,10 @@ const styles = { }, }; -function Navbar({ title, onBack, classes, children }) { +function Navbar({ title, onBack, classes, children, additionalToolbars }) { return ( <> - + {!!onBack && } @@ -24,8 +24,8 @@ function Navbar({ title, onBack, classes, children }) { {children} + {additionalToolbars} - ); } @@ -35,6 +35,7 @@ Navbar.propTypes = { onBack: PropTypes.func, classes: PropTypes.any, children: PropTypes.any, + additionalToolbars: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element]), }; export default withStyles(styles)(Navbar); diff --git a/src/scenes/graph/components/graph-large.component.js b/src/scenes/graph/components/graph-large.component.js index 2330959..182653f 100644 --- a/src/scenes/graph/components/graph-large.component.js +++ b/src/scenes/graph/components/graph-large.component.js @@ -3,6 +3,8 @@ import Grid from '@material-ui/core/Grid'; import { Box } from '@material-ui/core'; import { withStyles } from '@material-ui/core/styles'; +import Navbar from '../../../components/navbar'; +import ActionsMenu from './actions-menu'; import Editor from './editor'; import Groups from './groups'; import SelectedItems from './selection'; @@ -40,9 +42,12 @@ const styles = () => ({ }, }); -function GraphLarge({ classes }) { +function GraphLarge({ classes, openGraphList, graphName }) { return ( <> + + + diff --git a/src/scenes/graph/components/graph-small.component.js b/src/scenes/graph/components/graph-small.component.js index 1fa524c..e643cdd 100644 --- a/src/scenes/graph/components/graph-small.component.js +++ b/src/scenes/graph/components/graph-small.component.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; -import AppBar from '@material-ui/core/AppBar'; import Tabs from '@material-ui/core/Tabs'; import Tab from '@material-ui/core/Tab'; import Box from '@material-ui/core/Box'; import { withStyles } from '@material-ui/core/styles'; +import Navbar from '../../../components/navbar'; +import ActionsMenu from './actions-menu'; import Editor from './editor'; import Canvas from '../../../components/canvas'; @@ -28,17 +29,28 @@ function a11yProps(index) { }; } -function GraphSmall({ classes }) { +function GraphSmall({ graphName, openGraphList, classes }) { const [value, setValue] = useState(0); return ( <> - - setValue(newValue)} aria-label="editor and graph view in separate tabs"> - - - - + setValue(newValue)} + aria-label="editor and graph view in separate tabs" + variant="fullWidth" + > + + + + } + > + + - {value === 0 && } + - - - - {bigScreen && } - {!bigScreen && } + {bigScreen && } + {!bigScreen && } ); }