X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/040d25dbcc9ec46c4c21c945ccf02dcf1bf44c26..e70279bebea915b5ddbef11357ab7a36201d6d85:/src/components/breadcrumbs/breadcrumbs.tsx diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx index a3f9462e..25f30a1b 100644 --- a/src/components/breadcrumbs/breadcrumbs.tsx +++ b/src/components/breadcrumbs/breadcrumbs.tsx @@ -11,66 +11,45 @@ export interface Breadcrumb { label: string; } -interface BreadcrumbsDataProps { +interface BreadcrumbsProps { items: Breadcrumb[]; + onClick: (breadcrumb: Breadcrumb) => void; } -interface BreadcrumbsActionProps { - onClick: (breadcrumb: Breadcrumb) => any; -} - -type BreadcrumbsProps = BreadcrumbsDataProps & BreadcrumbsActionProps & WithStyles; - -class Breadcrumbs extends React.Component { - - render() { - const { classes, onClick } = this.props; - return - { - this.getInactiveItems().map((item, index) => ( +const Breadcrumbs: React.SFC> = ({ classes, onClick, items }) => { + return + { + items.map((item, index) => { + const isLastItem = index === items.length - 1; + return ( - + { + !isLastItem && + } - )) - } - { - this.getActiveItem().map((item, index) => ( - - )) - } - ; - } - - getInactiveItems = () => { - return this.props.items.slice(0, -1); - } - - getActiveItem = () => { - return this.props.items.slice(-1); - } - -} + ); + }) + } + ; +}; -type CssRules = 'inactiveItem'; +type CssRules = "item" | "currentItem"; const styles: StyleRulesCallback = theme => { const { unit } = theme.spacing; return { - inactiveItem: { + item: { opacity: 0.6 + }, + currentItem: { + opacity: 1 } }; };