Skip to content
Snippets Groups Projects
Commit ba04a5d5 authored by vkovtun's avatar vkovtun
Browse files

SSDM-13579: Added home directory to the navigation.

parent edc0150d
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -21,20 +21,28 @@ import autoBind from 'auto-bind' ...@@ -21,20 +21,28 @@ import autoBind from 'auto-bind'
import logger from "@src/js/common/logger.js"; import logger from "@src/js/common/logger.js";
import Container from "@src/js/components/common/form/Container.jsx"; import Container from "@src/js/components/common/form/Container.jsx";
import Link from "@material-ui/core/Link"; import Link from "@material-ui/core/Link";
import HomeIcon from "@material-ui/icons/Home";
import IconButton from "@material-ui/core/IconButton";
const color = 'default'
const buttonSize = 'small' const buttonSize = 'small'
const iconButtonSize = 'small'
const styles = theme => ({ const styles = theme => ({
navigationBar: { containerDefault: {
flex: '0 0 auto', flex: '0 0 auto',
display: 'flex', display: 'flex',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
marginLeft: theme.spacing(1), marginLeft: theme.spacing(1),
marginRight: theme.spacing(1), marginRight: theme.spacing(1),
fontSize: '1.125rem',
'& *': {
fontSize: '1.125rem'
},
'& .disabled': {
pointerEvents: 'none'
}
}, },
link: {
fontSize: theme.typography.body2.fontSize
}
}) })
class NavigationBar extends React.Component { class NavigationBar extends React.Component {
...@@ -60,11 +68,22 @@ class NavigationBar extends React.Component { ...@@ -60,11 +68,22 @@ class NavigationBar extends React.Component {
renderLinks() { renderLinks() {
const { classes, path, onPathChange } = this.props const { classes, path, onPathChange } = this.props
const { folders, paths } = this.splitPath(path) const { folders, paths } = this.splitPath(path)
const components = new Array(2 * paths.length + 1) const components = new Array(2 * paths.length + 2)
components[0] = '/' components[0] = <IconButton
key='root'
classes={{ root: classes.button }}
color={color}
size={iconButtonSize}
variant='outlined'
onClick={() => onPathChange('/')}
disabled={paths.length === 0}
>
<HomeIcon />
</IconButton>
components[1] = '/'
for (let i = 0; i < paths.length; i++) { for (let i = 0; i < paths.length; i++) {
components[2 * i + 1] = <Link components[2 * i + 2] = <Link
key={'path-' + i} key={'path-' + i}
classes={{ root: classes.link }} classes={{ root: classes.link }}
component="button" component="button"
...@@ -73,7 +92,7 @@ class NavigationBar extends React.Component { ...@@ -73,7 +92,7 @@ class NavigationBar extends React.Component {
> >
{folders[i]} {folders[i]}
</Link> </Link>
components[2 * i + 2] = '/' components[2 * i + 3] = '/'
} }
return components return components
...@@ -81,9 +100,10 @@ class NavigationBar extends React.Component { ...@@ -81,9 +100,10 @@ class NavigationBar extends React.Component {
render() { render() {
logger.log(logger.DEBUG, 'NavigationBar.render') logger.log(logger.DEBUG, 'NavigationBar.render')
const { classes } = this.props
return ( return (
<Container> <Container classes={{ containerDefault: classes.containerDefault }}>
{ this.renderLinks() } { this.renderLinks() }
</Container> </Container>
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment