2019-06-23 01:53:50 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import classNames from 'classnames';
|
2019-06-23 06:45:09 +00:00
|
|
|
import FlashMessageRender from '@/components/FlashMessageRender';
|
2019-06-23 01:53:50 +00:00
|
|
|
|
|
|
|
type Props = Readonly<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
|
|
title?: string;
|
|
|
|
borderColor?: string;
|
2019-06-23 06:45:09 +00:00
|
|
|
showFlashes?: string | boolean;
|
2019-06-23 01:53:50 +00:00
|
|
|
}>;
|
|
|
|
|
2019-06-23 06:45:09 +00:00
|
|
|
export default ({ title, borderColor, showFlashes, children, ...props }: Props) => (
|
2019-06-23 01:53:50 +00:00
|
|
|
<div {...props}>
|
2019-06-23 06:25:38 +00:00
|
|
|
{title && <h2 className={'text-neutral-300 mb-4 px-4'}>{title}</h2>}
|
2019-12-28 20:07:42 +00:00
|
|
|
{showFlashes &&
|
|
|
|
<FlashMessageRender
|
|
|
|
byKey={typeof showFlashes === 'string' ? showFlashes : undefined}
|
|
|
|
className={'mb-4'}
|
|
|
|
/>
|
|
|
|
}
|
2019-06-23 06:25:38 +00:00
|
|
|
<div className={classNames('bg-neutral-700 p-4 rounded shadow-lg relative', borderColor, {
|
2019-06-23 01:53:50 +00:00
|
|
|
'border-t-4': !!borderColor,
|
|
|
|
})}>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|