comicbox/components/Banner.tsx

23 lines
516 B
TypeScript
Raw Normal View History

import { ReactNode } from 'react';
2022-07-27 20:56:32 +00:00
type Style = 'error' | 'warning' | 'info';
interface Props {
children: ReactNode;
2022-07-27 20:56:32 +00:00
style: Style;
}
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',
};
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>
);
}