mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
add home icon to breadcrumb
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import {Link} from "react-router-dom";
|
||||
import type {Branch, Repository} from "@scm-manager/ui-types";
|
||||
import { Link } from "react-router-dom";
|
||||
import { translate } from "react-i18next";
|
||||
import injectSheet from "react-jss";
|
||||
import {binder, ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
import classNames from "classnames";
|
||||
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import Icon from "./Icon";
|
||||
|
||||
type Props = {
|
||||
repository: Repository,
|
||||
@@ -14,7 +16,10 @@ type Props = {
|
||||
revision: string,
|
||||
path: string,
|
||||
baseUrl: string,
|
||||
classes: any
|
||||
|
||||
// Context props
|
||||
classes: any,
|
||||
t: string => string
|
||||
};
|
||||
|
||||
const styles = {
|
||||
@@ -45,7 +50,7 @@ class Breadcrumb extends React.Component<Props> {
|
||||
if (paths.length - 1 === index) {
|
||||
return (
|
||||
<li className="is-active" key={index}>
|
||||
<Link to={"#"} aria-current="page">
|
||||
<Link to="#" aria-current="page">
|
||||
{path}
|
||||
</Link>
|
||||
</li>
|
||||
@@ -59,19 +64,20 @@ class Breadcrumb extends React.Component<Props> {
|
||||
});
|
||||
return map;
|
||||
}
|
||||
return <li />;
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
classes,
|
||||
baseUrl,
|
||||
branch,
|
||||
defaultBranch,
|
||||
branches,
|
||||
revision,
|
||||
path,
|
||||
repository
|
||||
repository,
|
||||
classes,
|
||||
t
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@@ -84,7 +90,18 @@ class Breadcrumb extends React.Component<Props> {
|
||||
)}
|
||||
aria-label="breadcrumbs"
|
||||
>
|
||||
<ul>{this.renderPath()}</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<Link to={baseUrl + "/" + revision + "/"}>
|
||||
<Icon
|
||||
title={t("breadcrumb.home")}
|
||||
name="home"
|
||||
color="inherit"
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
{this.renderPath()}
|
||||
</ul>
|
||||
</nav>
|
||||
{binder.hasExtension("repos.sources.actionbar") && (
|
||||
<div className={classes.buttonGroup}>
|
||||
@@ -112,4 +129,4 @@ class Breadcrumb extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default injectSheet(styles)(Breadcrumb);
|
||||
export default translate("commons")(injectSheet(styles)(Breadcrumb));
|
||||
|
||||
Reference in New Issue
Block a user