2020-09-27 09:51:29 +02:00
|
|
|
import classNames from 'classnames';
|
2022-12-27 01:57:59 +01:00
|
|
|
import { Banner, Loading } from 'react-basics';
|
2023-04-02 00:44:30 +02:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2023-03-22 05:28:36 +01:00
|
|
|
import styles from './Page.module.css';
|
2022-12-27 01:57:59 +01:00
|
|
|
|
|
|
|
export default function Page({ className, error, loading, children }) {
|
2023-04-02 00:44:30 +02:00
|
|
|
const { formatMessage, messages } = useMessages();
|
|
|
|
|
2022-12-27 01:57:59 +01:00
|
|
|
if (error) {
|
2023-04-02 00:44:30 +02:00
|
|
|
return <Banner variant="error">{formatMessage(messages.error)}</Banner>;
|
2022-12-27 01:57:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (loading) {
|
2023-01-10 08:59:26 +01:00
|
|
|
return <Loading icon="spinner" size="xl" position="page" />;
|
2022-12-27 01:57:59 +01:00
|
|
|
}
|
2020-08-06 04:04:02 +02:00
|
|
|
|
2022-08-23 09:51:37 +02:00
|
|
|
return <div className={classNames(styles.page, className)}>{children}</div>;
|
2020-08-06 04:04:02 +02:00
|
|
|
}
|