Files
kandev/apps/web/components/settings/settings-section.tsx
T
João Salavisa 3952e35c8d fix(web): keep settings section actions aligned on narrow screens (#1727)
The section header squeezed the actions toolbar next to the title, so
on smaller widths the Workflows toolbar wrapped with its second row
left-dangling (Add Workflow floating alone). The header now stacks the
actions under the title below sm, protects them from compression by
long descriptions, and right-aligns wrapped toolbar rows beside the
title.

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 11:21:19 +01:00

37 lines
1.0 KiB
TypeScript

import { ReactNode } from "react";
type SettingsSectionProps = {
icon?: ReactNode;
title: string;
description?: string;
action?: ReactNode;
children: ReactNode;
};
export function SettingsSection({
icon,
title,
description,
action,
children,
}: SettingsSectionProps) {
return (
<section className="space-y-4">
{/* Stack the action row under the title on narrow screens instead of
squeezing both onto one line; shrink-0 keeps the actions from being
compressed by a long description when side by side. */}
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
<div className="min-w-0">
<h3 className="text-lg font-semibold flex items-center gap-2">
{icon}
{title}
</h3>
{description && <p className="text-sm text-muted-foreground mt-1">{description}</p>}
</div>
{action && <div className="shrink-0">{action}</div>}
</div>
{children}
</section>
);
}