2022-07-27 14:42:04 +00:00
|
|
|
import { ReactNode } from 'react';
|
|
|
|
|
2022-07-27 20:56:32 +00:00
|
|
|
type Style = 'error' | 'warning' | 'info';
|
|
|
|
|
2022-07-27 14:42:04 +00:00
|
|
|
interface Props {
|
|
|
|
children: ReactNode;
|
2022-07-27 20:56:32 +00:00
|
|
|
style: Style;
|
2022-07-27 14:42:04 +00:00
|
|
|
}
|
|
|
|
|
2022-07-27 20:56:32 +00:00
|
|
|
const COLOUR_MAP: { [P in Style]: string } = {
|
|
|
|
info: 'bg-blue-400 border-blue-600',
|
|
|
|
error: 'bg-red-900 border-red-700',
|
|
|
|
warning: 'bg-orange-900 border-orange-700',
|
|
|
|
};
|
|
|
|
|
2022-07-27 14:42:04 +00:00
|
|
|
export default function Banner(props: Props) {
|
2022-07-27 21:10:23 +00:00
|
|
|
return (
|
|
|
|
<div className={'border-2 rounded-lg p-3 ' + COLOUR_MAP[props.style]}>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
);
|
2022-07-27 14:42:04 +00:00
|
|
|
}
|