Add className option for Title component, add administration title

This commit is contained in:
Florian Scholdei
2019-12-12 17:10:42 +01:00
parent 90c78cfeba
commit 44f1d5406e
6 changed files with 22 additions and 6 deletions

View File

@@ -1,14 +1,16 @@
import React from "react";
import classNames from "classnames";
type Props = {
subtitle?: string;
className?: string;
};
class Subtitle extends React.Component<Props> {
render() {
const { subtitle } = this.props;
const { subtitle, className } = this.props;
if (subtitle) {
return <h2 className="subtitle">{subtitle}</h2>;
return <h2 className={classNames("subtitle", className)}>{subtitle}</h2>;
}
return null;
}

View File

@@ -1,12 +1,14 @@
import React, { FC, useEffect } from "react";
import classNames from "classnames";
type Props = {
title?: string;
customPageTitle?: string;
preventRefreshingPageTitle?: boolean;
className?: string;
};
const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle }) => {
const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle, className }) => {
useEffect(() => {
if (!preventRefreshingPageTitle) {
if (customPageTitle) {
@@ -18,7 +20,7 @@ const Title: FC<Props> = ({ title, preventRefreshingPageTitle, customPageTitle }
});
if (title) {
return <h1 className="title">{title}</h1>;
return <h1 className={classNames("title", className)}>{title}</h1>;
}
return null;
};