Files
gridpilot.gg/apps/website/ui/Section.tsx
2026-01-19 12:35:16 +01:00

53 lines
1.1 KiB
TypeScript

import { ReactNode } from 'react';
import { Box } from './Box';
export interface SectionProps {
children: ReactNode;
variant?: 'default' | 'dark' | 'muted';
padding?: 'none' | 'sm' | 'md' | 'lg';
id?: string;
minHeight?: string;
py?: number;
className?: string;
}
export const Section = ({
children,
variant = 'default',
padding = 'md',
id,
minHeight,
py,
className
}: SectionProps) => {
const variantClasses = {
default: 'bg-[var(--ui-color-bg-base)]',
dark: 'bg-black',
muted: 'bg-[var(--ui-color-bg-surface)]',
};
const paddingClasses = {
none: 'py-0',
sm: 'py-8',
md: 'py-16',
lg: 'py-24',
};
const classes = [
variantClasses[variant],
py !== undefined ? '' : paddingClasses[padding],
className,
].join(' ');
return (
<section id={id} className={classes} style={{
...(minHeight ? { minHeight } : {}),
...(py !== undefined ? { paddingTop: `${py * 0.25}rem`, paddingBottom: `${py * 0.25}rem` } : {})
}}>
<Box marginX="auto" maxWidth="80rem" paddingX={4}>
{children}
</Box>
</section>
);
};