'use client'; /** * @file FormSection.tsx * @description Reusable form section wrapper with title, icon, and internal grid. * Groups related form fields visually and logically. * * @example * } columns={2}> * * * */ import React from 'react'; import { FormSectionProps } from '@/types/publications'; /** Maps column count to Tailwind grid class */ const gridColsMap: Record = { 1: 'grid-cols-1', 2: 'grid-cols-1 md:grid-cols-2', 3: 'grid-cols-1 md:grid-cols-3', 4: 'grid-cols-2 md:grid-cols-4', 6: 'grid-cols-2 md:grid-cols-6', 12: 'grid-cols-12', }; export const FormSection: React.FC = ({ title, icon, columns = 2, children, className = '', }) => { const gridClass = gridColsMap[columns] ?? 'grid-cols-1 md:grid-cols-2'; return (
{/* Section Header */}
{icon && (
{icon}
)}
{title}
{/* Fields Grid */}
{children}
); }; export default FormSection;