Render namespace as link in repo detail header

This commit is contained in:
René Pfeuffer
2020-09-07 13:39:12 +02:00
parent 9ae3576bcd
commit 794b207f1f
3 changed files with 12 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ import ErrorBoundary from "../ErrorBoundary";
type Props = {
title?: string;
titleComponent?: ReactNode;
afterTitle?: ReactNode;
subtitle?: string;
loading?: boolean;
@@ -90,7 +91,7 @@ export default class Page extends React.Component<Props> {
}
renderPageHeader() {
const { error, title, afterTitle, subtitle, children } = this.props;
const { error, title, titleComponent, afterTitle, subtitle, children } = this.props;
let pageActions = null;
let pageActionsExists = false;
@@ -115,7 +116,7 @@ export default class Page extends React.Component<Props> {
<div className="columns">
<div className="column">
<FlexContainer>
<Title title={title} /> {afterTitle && <MarginLeft>{afterTitle}</MarginLeft>}
<Title title={title}>{titleComponent}</Title>{afterTitle && <MarginLeft>{afterTitle}</MarginLeft>}
</FlexContainer>
<Subtitle subtitle={subtitle} />
</div>

View File

@@ -31,7 +31,7 @@ type Props = {
className?: string;
};
const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle, className }) => {
const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle, className , children}) => {
useEffect(() => {
if (!preventRefreshingPageTitle) {
if (customPageTitle) {
@@ -42,7 +42,9 @@ const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle,
}
}, [title, preventRefreshingPageTitle, customPageTitle]);
if (title) {
if (children) {
return <h1 className={classNames("title", className)}>{children}</h1>;
} else if (title) {
return <h1 className={classNames("title", className)}>{title}</h1>;
}
return null;