factor out config error handling

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-08 20:03:45 +01:00
parent 4954c732ee
commit 2837c41ca4
3 changed files with 40 additions and 32 deletions

View file

@ -17,23 +17,29 @@ limitations under the License.
import * as React from "react";
import * as PropTypes from "prop-types";
import { _t } from "matrix-react-sdk/src/languageHandler";
interface IProps {
title: React.ReactNode;
message: React.ReactNode;
title: string;
messages?: string[];
}
const ErrorView: React.FC<IProps> = ({title, message}) => {
const ErrorView: React.FC<IProps> = ({title, messages}) => {
return <div className="mx_GenericErrorPage">
<div className="mx_GenericErrorPage_box">
<h1>{ title }</h1>
<p>{ message }</p>
<h1>{title}</h1>
<div>
{messages && messages.map(msg => <p key={msg}>
{ _t(msg) }
</p>)}
</div>
</div>
</div>;
};
ErrorView.propTypes = {
title: PropTypes.object.isRequired, // jsx for title
message: PropTypes.object.isRequired, // jsx to display
title: PropTypes.string.isRequired,
messages: PropTypes.arrayOf(PropTypes.string.isRequired),
};
export default ErrorView;