Files

25 lines
802 B
TypeScript
Raw Permalink Normal View History

import React from 'react';
2026-10-12 09:04:03 -04:00
import Card from '@/components/elements/Card';
2026-10-05 18:10:18 -04:00
import { cn } from '@/lib/cn';
import { sectionTitleClass } from '@/components/ui/typography';
type Props = Readonly<
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
title?: string;
borderColor?: string;
showLoadingOverlay?: boolean;
}
>;
2026-10-12 09:04:03 -04:00
/** A section title above a plain `Card`. */
2026-10-05 18:10:18 -04:00
const ContentBox = ({ title, borderColor, showLoadingOverlay, children, ...props }: Props) => (
<div {...props}>
2026-10-05 18:10:18 -04:00
{title && <h2 className={cn(sectionTitleClass, 'mb-4 px-4')}>{title}</h2>}
2026-10-12 09:04:03 -04:00
<Card loading={showLoadingOverlay} className={borderColor ? 'border-t-4' : undefined}>
{children}
2026-10-12 09:04:03 -04:00
</Card>
</div>
);
2020-02-08 15:23:08 -08:00
export default ContentBox;