'use client' import type { ReactNode } from 'react' import { cn } from '@langgenius/dify-ui/cn' type SectionProps = { title: string description?: string action?: ReactNode children: ReactNode layout?: 'block' | 'row' tone?: 'default' | 'destructive' showDivider?: boolean } export function Section({ title, description, action, children, layout = 'block', tone = 'default', showDivider = true, }: SectionProps) { const hasAction = Boolean(action) const titleClassName = cn( 'system-sm-semibold', tone === 'destructive' ? 'text-util-colors-red-red-700' : layout === 'row' ? 'text-text-secondary' : 'text-text-primary', ) const descriptionClassName = cn( 'mt-1 body-xs-regular', tone === 'destructive' ? 'text-util-colors-red-red-600' : 'text-text-tertiary', ) if (layout === 'row') { return (
{title}
{description &&

{description}

}
{hasAction ? (
{children}
{action}
) : ( children )}
) } return (
{title}
{hasAction &&
{action}
}
{description &&

{description}

}
{children}
) }