'use client';

import { Heading } from '@/ui/Heading';
import { Stack } from '@/ui/primitives/Stack';
import { Text } from '@/ui/Text';
import React from 'react';

interface ProfileSectionProps {
  title: string;
  description?: string;
  action?: React.ReactNode;
  children: React.ReactNode;
}

export function ProfileSection({ title, description, action, children }: ProfileSectionProps) {
  return (
    <Stack mb={8}>
      <Stack direction="row" align="center" justify="between" mb={4}>
        <Stack>
          <Heading level={2}>{title}</Heading>
          {description && (
            <Text color="text-gray-400" size="sm" mt={1} block>
              {description}
            </Text>
          )}
        </Stack>
        {action && <Stack>{action}</Stack>}
      </Stack>
      <Stack>{children}</Stack>
    </Stack>
  );
}
