Files
gridpilot.gg/apps/website/ui/Section.tsx
Marc Mintel fb1221701d
Some checks failed
Contract Testing / contract-tests (push) Failing after 6m7s
Contract Testing / contract-snapshot (push) Failing after 4m46s
add tests
2026-01-22 11:52:42 +01:00

61 lines
1.2 KiB
TypeScript

import React from 'react';
import { ReactNode } from 'react';
import { Box } from './Box';
export interface SectionProps {
children: ReactNode;
variant?: 'default' | 'dark' | 'muted';
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
id?: string;
minHeight?: string;
fullWidth?: boolean;
maxWidth?: string;
/** @deprecated Use semantic props instead. */
className?: string;
}
export const Section = ({
children,
variant = 'default',
padding = 'md',
id,
minHeight,
fullWidth = false,
maxWidth = '80rem',
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',
xl: 'py-32',
};
const classes = [
variantClasses[variant],
paddingClasses[padding],
className,
].join(' ');
return (
<section id={id} className={classes} style={{
...(minHeight ? { minHeight } : {}),
}}>
{fullWidth ? (
children
) : (
<Box marginX="auto" maxWidth={maxWidth} paddingX={4}>
{children}
</Box>
)}
</section>
);
};