2020-07-03 15:37:26 -07:00
|
|
|
import React from 'react';
|
2020-03-25 21:58:37 -07:00
|
|
|
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
|
2026-10-05 18:10:18 -04:00
|
|
|
import { cn } from '@/lib/cn';
|
|
|
|
|
import { sectionTitleClass } from '@/components/ui/typography';
|
2019-06-22 18:53:50 -07:00
|
|
|
|
2022-06-26 15:13:52 -04:00
|
|
|
type Props = Readonly<
|
|
|
|
|
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
|
|
|
title?: string;
|
|
|
|
|
borderColor?: string;
|
|
|
|
|
showLoadingOverlay?: boolean;
|
|
|
|
|
}
|
|
|
|
|
>;
|
2019-06-22 18:53:50 -07:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
const ContentBox = ({ title, borderColor, showLoadingOverlay, children, ...props }: Props) => (
|
2019-06-22 18:53:50 -07:00
|
|
|
<div {...props}>
|
2026-10-05 18:10:18 -04:00
|
|
|
{title && <h2 className={cn(sectionTitleClass, 'mb-4 px-4')}>{title}</h2>}
|
|
|
|
|
<div className={cn('bg-card p-4 rounded-sm shadow-lg relative', !!borderColor && 'border-t-4')}>
|
2022-06-26 15:13:52 -04:00
|
|
|
<SpinnerOverlay visible={showLoadingOverlay || false} />
|
2019-06-22 18:53:50 -07:00
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2020-02-08 15:23:08 -08:00
|
|
|
|
|
|
|
|
export default ContentBox;
|