Files
ThreadNet-Web/src/components/structures/ErrorMessage.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
820 B
TypeScript
Raw Normal View History

2022-11-22 07:58:37 +01:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
2022-11-22 07:58:37 +01:00
Copyright 2022 The Matrix.org Foundation C.I.C.
2024-09-09 14:57:16 +01:00
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
2022-11-22 07:58:37 +01:00
*/
import React, { ReactNode } from "react";
2023-03-08 11:11:01 +01:00
import { Icon as WarningBadgeIcon } from "../../../res/img/compound/error-16px.svg";
2022-11-22 07:58:37 +01:00
interface ErrorMessageProps {
message: string | ReactNode | null;
}
/**
* Error message component.
* Reserves two lines to display errors to prevent layout shifts when the error pops up.
*/
export const ErrorMessage: React.FC<ErrorMessageProps> = ({ message }) => {
const icon = message ? <WarningBadgeIcon className="mx_Icon mx_Icon_16" /> : null;
return (
<div className="mx_ErrorMessage">
{icon}
{message}
</div>
);
};