Skip to content

Commit

Permalink
Merge pull request #962 from unicef/feature/#927-styling-spacing
Browse files Browse the repository at this point in the history
fixes and changes to layout/ui
  • Loading branch information
Adam Podsiadło authored Jan 29, 2018
2 parents cc81118 + 04a75a3 commit e4778b9
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 68 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/common/headerNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const styleSheet = (theme) => {
'@media print': {
borderBottom: '0',
},
background: '#fff',
},
alignItems: {
display: 'flex',
Expand All @@ -41,7 +42,6 @@ const styleSheet = (theme) => {
alignItemsPadding: {
display: 'flex',
alignItems: 'flex-end',
paddingBottom: `${padding}px`,
},
flex: {
alignItems: 'flex-end',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/common/list/paginatedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const table = {
};

const styleSheet = (theme) => {
const paddingSmall = theme.spacing.unit * 3;

const paddingSmall = theme.spacing.unit * 2;
const paddingBig = theme.spacing.unit * 3;
return {
container: {
padding: `${paddingSmall}px 0 ${paddingSmall}px ${paddingSmall}px`,
padding: `${paddingSmall}px 0 ${paddingSmall}px ${paddingBig}px`,
},
};
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/list/selectableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const table = {
};

const styleSheet = (theme) => {
const paddingSmall = theme.spacing.unit * 3;
const paddingSmall = theme.spacing.unit * 2;
const paddingMedium = theme.spacing.unit * 4;

return {
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/common/mainContentWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import Paper from 'material-ui/Paper';

const styleSheet = theme => ({
root: {
background: theme.palette.primary[200],
padding: theme.spacing.unit * 3,
height: '100%',
background: 'inherit',
},
});

Expand Down
9 changes: 2 additions & 7 deletions frontend/src/components/layout/appBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import SidebarMenu from './sidebarMenu';
import Logout from './logout';

const styleSheet = theme => ({
root: {
height: 60,
display: 'flex',
width: '100%',
},
leftHeader: {
[theme.breakpoints.down('xs')]: {
width: '100%',
Expand Down Expand Up @@ -85,7 +80,7 @@ class MainAppBar extends Component {
render() {
const { classes } = this.props;
return (
<div className={classes.root}>
<React.Fragment>
<AppBar
className={`${classes.header} ${classes.leftHeader} ${classes.noPrint}`}
position="static"
Expand Down Expand Up @@ -148,7 +143,7 @@ class MainAppBar extends Component {
>
<Logout />
</Popover>
</div>
</React.Fragment>
);
}
}
Expand Down
47 changes: 19 additions & 28 deletions frontend/src/components/layout/mainLayout.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import Grid from 'material-ui/Grid';
import Paper from 'material-ui/Paper';
import SidebarMenu from './sidebarMenu';
import MainAppBar from './appBar';

// TODO check what can be done in muiTheme
const styleSheet = theme => ({
root: {
margin: 'auto',
display: 'grid',
gridTemplateColumns: '224px auto',
gridTemplateRows: `${theme.spacing.unit * 8}px auto`,
height: '100vh',
width: '100vw',
},
rightItem: {
overflowX: 'scroll',
height: '100%',
width: '100%',
flexShrink: 1,
overflow: 'scroll',
background: theme.palette.primary[200],
},
border: {
},
leftItem: {
fullWidth: {
[theme.breakpoints.down('md')]: {
width: '100%',
gridColumnEnd: 'span 2',
},
width: theme.spacing.unit * 28,
flex: '0 0 auto',
borderRight: `2px ${theme.palette.primary[300]} solid`,
},
paper: {
minHeight: 'calc(100vh - 60px)',
display: 'flex',
width: '100%',
[theme.breakpoints.down('md')]: {
flexDirection: 'column',
},
leftItem: {
borderRight: `2px ${theme.palette.primary[300]} solid`,
},
noPrint: {
'@media print': {
Expand Down Expand Up @@ -76,17 +69,15 @@ class MainLayout extends Component {
render() {
const { classes, children } = this.props;
return (
<Grid container spacing={0} className={classes.root}>
<div className={classes.root}>
<MainAppBar />
<Paper className={classes.paper}>
<div className={`${classes.leftItem} ${classes.noPrint}`}>
<SidebarMenu />
</div>
<div className={classes.rightItem}>
{children}
</div>
</Paper>
</Grid>
<div className={`${classes.leftItem} ${classes.noPrint} ${classes.fullWidth}`}>
<SidebarMenu />
</div>
<div className={`${classes.rightItem} ${classes.fullWidth}`}>
{children}
</div>
</div>
);
}
}
Expand Down
24 changes: 23 additions & 1 deletion frontend/src/components/layout/menuLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ import React from 'react';
import PropTypes from 'prop-types';
import { ListItem, ListItemText, ListItemIcon } from 'material-ui/List';
import Hidden from 'material-ui/Hidden';
import { withStyles } from 'material-ui/styles';

const styleSheet = theme => ({
default: {
paddingTop: theme.spacing.unit,
paddingBottom: theme.spacing.unit,
},
icon: {
color: 'inherit',
},
button: {
'&:hover': {
backgroundColor: theme.palette.primary[200],
color: theme.palette.secondary[500],
},
'&.active': {
backgroundColor: theme.palette.primary[200],
color: theme.palette.secondary[500],
},
},
});

const menuLink = (props) => {
const { active, onClick, icon, label, classes } = props;
Expand All @@ -10,6 +31,7 @@ const menuLink = (props) => {
className={active ? 'active' : ''}
classes={{
button: classes.button,
default: classes.default,
}}
button
onClick={onClick}
Expand All @@ -32,4 +54,4 @@ menuLink.propTypes = {
classes: PropTypes.object,
};

export default menuLink;
export default withStyles(styleSheet, { name: 'menuLink' })(menuLink);
26 changes: 2 additions & 24 deletions frontend/src/components/layout/sidebarMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,12 @@ const styleSheet = theme => ({
alignContent: 'space-between',
},
logo: {
[theme.breakpoints.down('md')]: {
width: '100%',
position: 'inherit',
},
width: theme.spacing.unit * 28,
position: 'fixed',
bottom: 0,
width: '100%',
},
innerLogo: {
padding: theme.spacing.unit * 2,
},
icon: {
color: 'inherit',
},
button: {
'&:hover': {
backgroundColor: theme.palette.primary[200],
color: theme.palette.secondary[500],
},
'&.active': {
backgroundColor: theme.palette.primary[200],
color: theme.palette.secondary[500],
},
},

});

function sidebarMenu(props) {
Expand All @@ -52,10 +34,6 @@ function sidebarMenu(props) {
label={item.label}
key={item.label}
icon={createElement(item.icon)}
classes={{
button: classes.button,
icon: classes.icon,
}}
onClick={() => onItemClick(index, item.path)}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PartnerProfileEdit extends Component {
backButton
defaultReturn={`/profile/${id}/overview`}
handleChange={this.handleChange}
tabsProps={{ scrollButtons: 'on' }}
tabsProps={{ scrollButtons: 'auto' }}
>
{(index !== -1) && children}
</HeaderNavigation>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/styles/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
html {
height: 100%;
font-family: 'Roboto', sans-serif;
font-size: 14px;
}

body {
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/styles/muiTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ const theme = {
MuiDefaultTab: {
fontWeight: 400,
},
MuiTableHead: {
root: {
fontSize: '0.9rem',
},
},
MuiTableBody: {
root: {
fontSize: '1rem',
},
},
MuiTab: {
rootLabelIcon: {
height: '48px',
},
},
},
};
const getTheme = () => (
Expand Down

0 comments on commit e4778b9

Please sign in to comment.