1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { Button, Grid, StyleRulesCallback, WithStyles } from '@material-ui/core';
7 import ChevronRightIcon from '@material-ui/icons/ChevronRight';
8 import { withStyles } from '@material-ui/core';
10 interface BreadcrumbsDataProps {
14 type BreadcrumbsProps = BreadcrumbsDataProps & WithStyles<CssRules>;
16 class Breadcrumbs extends React.Component<BreadcrumbsProps> {
19 const { classes } = this.props;
20 return <Grid container alignItems="center">
22 this.getInactiveItems().map((item, index) => (
23 <React.Fragment key={index}>
24 <Button color="inherit" className={classes.inactiveItem}>{item}</Button>
25 <ChevronRightIcon color="inherit" className={classes.inactiveItem} />
30 this.getActiveItem().map((item, index) => (
31 <Button key={index} color="inherit">{item}</Button>
37 getInactiveItems = () => {
38 return this.props.items.slice(0, -1)
41 getActiveItem = () => {
42 return this.props.items.slice(-1)
46 type CssRules = 'inactiveItem'
48 const styles: StyleRulesCallback<CssRules> = theme => {
49 const { unit } = theme.spacing
57 export default withStyles(styles)(Breadcrumbs)