Skip to content

Commit

Permalink
Add app styling improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewelinagr committed Jun 4, 2024
1 parent ec76836 commit 267b559
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 56 deletions.
50 changes: 38 additions & 12 deletions projects/mercury/src/App.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@ const globalTheme = createTheme({
primary: {
main: COLORS.fsBlueMedium,
light: COLORS.fsBlueLight,
dark: COLORS.fsBlueDark
dark: COLORS.fsBlueDark,
contrastText: 'white'
},
secondary: {
main: '#758bfd'
},
error: pink,
success: {
main: '#08a045'
},
secondary: pink,
background: {
default: '#d9d9d9'
default: '#eef0eb'
}
}
});

export default createTheme({
...globalTheme,
typography: {
fontFamily: ['Sora', 'Palanquin'].join(','),
button: {
textTransform: 'none'
}
Expand Down Expand Up @@ -115,20 +123,43 @@ export default createTheme({
styleOverrides: {
root: {
background: globalTheme.palette.primary.dark,
'&:hover': {
background: globalTheme.palette.primary.light
},
borderRadius: 15,
borderColor: globalTheme.palette.primary.light,
paddingBottom: 0,
paddingTop: 0,
minHeight: 35
},
text: {
color: globalTheme.palette.primary.contrastText
}
}
},
MuiCardHeader: {
styleOverrides: {
root: {
backgroundColor: 'whitesmoke',
backgroundColor: globalTheme.palette.primary.dark,
marginBottom: 0,
padding: 5
padding: 5,
borderRadius: 15
},
title: {
color: globalTheme.palette.primary.contrastText
},
avatar: {
color: globalTheme.palette.primary.contrastText
},
subheader: {
color: globalTheme.palette.primary.contrastText
}
}
},
MuiCardContent: {
styleOverrides: {
root: {
borderRadius: 15
}
}
},
Expand Down Expand Up @@ -157,15 +188,10 @@ export default createTheme({
styleOverrides: {
root: {
backgroundColor: globalTheme.palette.background.default,
// borderRadius: 15,
border: '1px solid',
borderColor: globalTheme.palette.primary.dark
}
}
},
MuiBox: {
styleOverrides: {
root: {
},
rounded: {
borderRadius: 15
}
}
Expand Down
2 changes: 1 addition & 1 deletion projects/mercury/src/collections/CollectionsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const CollectionsPage = (props: CollectionsPageProperties) => {
</Grid>
{showMetadataSearchButton && (
<Grid item container xs={4} justifyContent="flex-end">
<Grid item>
<Grid item className={classes.metadataButton}>
<Button variant="text" color="primary" href={getMetadataViewsPath(RESOURCES_VIEW)}>
Collection metadata search
</Button>
Expand Down
4 changes: 4 additions & 0 deletions projects/mercury/src/collections/CollectionsPage.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ const styles = () => ({
width: consts.MAIN_CONTENT_WIDTH
},
topBarSwitch: {
paddingLeft: 8,
textAlign: 'right',
whiteSpace: 'nowrap'
},
metadataButton: {
paddingRight: 8
},
centralPanel: {
width: consts.MAIN_CONTENT_WIDTH,
maxHeight: consts.MAIN_CONTENT_MAX_HEIGHT
Expand Down
3 changes: 2 additions & 1 deletion projects/mercury/src/dashboard/DomainInfo.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const styles = theme => ({
height: '100px',
borderStyle: 'solid',
borderColor: theme.palette.primary.light,
background: theme.palette.primary.dark,
borderWidth: 2,
textAlign: 'center'
},
Expand All @@ -25,7 +26,7 @@ const styles = theme => ({
width: 'inherit'
},
domainText: {
color: theme.palette.grey[700]
color: theme.palette.primary.contrastText
},
link: {
textDecoration: 'none'
Expand Down
2 changes: 1 addition & 1 deletion projects/mercury/src/file/FilesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const FilesPage = (props: FilesPageProperties) => {
</Grid>
{showMetadataSearchButton && (
<Grid item container xs={4} justifyContent="flex-end">
<Grid item>
<Grid item className={classes.metadataButton}>
<Button
variant="text"
color="primary"
Expand Down
4 changes: 4 additions & 0 deletions projects/mercury/src/file/FilesPage.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ const styles = () => ({
width: consts.MAIN_CONTENT_WIDTH
},
topBarSwitch: {
paddingLeft: 8,
textAlign: 'right',
whiteSpace: 'nowrap'
},
metadataButton: {
paddingRight: 8
},
centralPanel: {
width: consts.MAIN_CONTENT_WIDTH,
maxHeight: consts.MAIN_CONTENT_MAX_HEIGHT
Expand Down
3 changes: 3 additions & 0 deletions projects/mercury/src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import url('https://fonts.googleapis.com/css?family=Sora&display=swap');
@import url('https://fonts.googleapis.com/css?family=Palanquin&display=swap');

body {
margin: 0;
padding: 0;
Expand Down
61 changes: 44 additions & 17 deletions projects/mercury/src/layout/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import ExternalMetadataSourceContext from '../metadata/metadata-sources/External
import {getExternalStoragePathPrefix} from '../external-storage/externalStorageUtils';
import {getExternalMetadataSourcePathPrefix} from '../metadata/external-views/externalMetadataSourceUtils';
import InternalMetadataSourceContext from '../metadata/metadata-sources/InternalMetadataSourceContext';
import {COLORS} from '../App.theme';

const styles = {
const styles = theme => ({
buttonStack: {
paddingLeft: 20,
paddingRight: 20
Expand All @@ -28,7 +29,7 @@ const styles = {
paddingTop: 15,
paddingBottom: 15,
textAlign: 'center',
color: 'white',
color: theme.palette.primary.contrastText,
height: 40
},
mainMenuButtonSmall: {
Expand All @@ -40,6 +41,9 @@ const styles = {
marginLeft: 0
}
},
mainMenuButtonSelected: {
backgroundColor: COLORS.fsBlueLightTransp25
},
imageIcon: {
display: 'flex',
height: 'inherit',
Expand All @@ -48,7 +52,7 @@ const styles = {
iconRoot: {
textAlign: 'center'
}
};
});
const MainMenu = ({open, classes}) => {
const {pathname} = window.location;
const {services} = useContext(ServicesContext);
Expand All @@ -65,33 +69,42 @@ const MainMenu = ({open, classes}) => {
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith('/dashboard') && classes.mainMenuButtonSelected
)}
component={NavLink}
to="/dashboard"
selected={pathname.startsWith('/dashboard')}
startIcon={<HomeIcon />}
>
{open && 'Home'}
</Button>
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith('/workspace') && classes.mainMenuButtonSelected
)}
component={NavLink}
to="/workspaces"
selected={pathname.startsWith('/workspace')}
startIcon={<Widgets />}
>
{open ? 'Workspaces' : null}
</Button>
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith('/collections') && classes.mainMenuButtonSelected
)}
key="collections"
component={NavLink}
to="/collections"
selected={pathname.startsWith('/collections')}
startIcon={<Folder />}
>
{open && 'Collections'}
Expand All @@ -101,11 +114,15 @@ const MainMenu = ({open, classes}) => {
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith(getExternalStoragePathPrefix(storage.name)) &&
classes.mainMenuButtonSelected
)}
key={getExternalStoragePathPrefix(storage.name)}
component={NavLink}
to={getExternalStoragePathPrefix(storage.name)}
selected={pathname.startsWith(getExternalStoragePathPrefix(storage.name))}
startIcon={<FolderSpecial />}
>
{open && storage.label}
Expand All @@ -115,11 +132,14 @@ const MainMenu = ({open, classes}) => {
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith('/metadata-views') && classes.mainMenuButtonSelected
)}
key="metadata-views"
component={NavLink}
to="/metadata-views"
selected={pathname.startsWith('/metadata-views')}
startIcon={
internalMetadataIcon ? (
<Icon classes={{root: classes.iconRoot}}>
Expand All @@ -139,11 +159,15 @@ const MainMenu = ({open, classes}) => {
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith(getExternalMetadataSourcePathPrefix(source.name)) &&
classes.mainMenuButtonSelected
)}
key={getExternalMetadataSourcePathPrefix(source.name)}
component={NavLink}
to={getExternalMetadataSourcePathPrefix(source.name)}
selected={pathname.startsWith(getExternalMetadataSourcePathPrefix(source.name))}
startIcon={
source.icon ? (
<Icon classes={{root: classes.iconRoot}}>
Expand All @@ -165,11 +189,14 @@ const MainMenu = ({open, classes}) => {
<Button
variant="outlined"
size="small"
className={classNames(classes.mainMenuButton, !open && classes.mainMenuButtonSmall)}
className={classNames(
classes.mainMenuButton,
!open && classes.mainMenuButtonSmall,
pathname.startsWith('/users') && classes.mainMenuButtonSelected
)}
key="users"
component={NavLink}
to="/users"
selected={pathname.startsWith('/users')}
startIcon={<VerifiedUser />}
>
{open && 'Users'}
Expand Down
4 changes: 3 additions & 1 deletion projects/mercury/src/layout/MenuDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';

import styles from './MenuDrawer.styles';
import UserMenu from './UserMenu';

const MenuDrawer = ({open, renderMenu, toggleMenuExpansion, onMouseEnter, onMouseLeave, classes}) => (
<Drawer
Expand All @@ -25,7 +26,8 @@ const MenuDrawer = ({open, renderMenu, toggleMenuExpansion, onMouseEnter, onMous
<div onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
{renderMenu(open)}
</div>
<div className={classes.toolbar}>
<div className={open ? classes.toolbar : classes.toolbarCollapsed}>
<UserMenu menuOpen={open} />
<IconButton onClick={toggleMenuExpansion} size="medium" className={classes.toolbarIcon}>
{open ? <ChevronLeftIcon /> : <ChevronRightIcon />}
</IconButton>
Expand Down
15 changes: 13 additions & 2 deletions projects/mercury/src/layout/MenuDrawer.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ const styles = theme => ({
},
toolbar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
alignItems: 'center',
padding: '0 8px',
marginTop: 20,
...theme.mixins.toolbar
},
toolbarCollapsed: {
display: 'flex',
flexDirection: 'column',
height: 80,
alignItems: 'center',
padding: '0 8px',
marginTop: 20,
...theme.mixins.toolbar
},
toolbarIcon: {
color: 'white'
color: 'white',
marginLeft: 'auto'
},
mainLogo: {
flexGrow: 1,
Expand Down
3 changes: 0 additions & 3 deletions projects/mercury/src/layout/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {AppBar, Toolbar} from '@mui/material';

import withStyles from '@mui/styles/withStyles';

import UserMenu from './UserMenu';

const styles = theme => ({
root: {
zIndex: theme.zIndex.drawer + 1
Expand All @@ -24,7 +22,6 @@ const TopBar = ({classes, children}) => (
<img src="/images/icon_white.png" alt="Fairspace" height="60" />
</div>
{children}
<UserMenu />
</Toolbar>
</AppBar>
);
Expand Down
Loading

0 comments on commit 267b559

Please sign in to comment.