

import { LucideIcon } from 'lucide-react';
import React from 'react';
import { Box } from './Box';
import { Heading } from './Heading';
import { Icon } from './Icon';
import { Stack } from './Stack';
import { Surface } from './Surface';
import { Text } from './Text';

interface PageHeaderProps {
  title: string;
  description?: string;
  action?: React.ReactNode;
  icon?: LucideIcon;
}

export function PageHeader({ 
  title, 
  description,
  action,
  icon,
}: PageHeaderProps) {
  return (
    <Box 
      marginBottom={12} 
      display="flex" 
      flexDirection={{ base: 'col', md: 'row' }} 
      alignItems={{ md: 'end' }} 
      justifyContent="space-between" 
      gap={6} 
      borderBottom="1px solid var(--ui-color-border-muted)"
      paddingBottom={6}
    >
      <Box>
        <Stack direction="row" align="center" gap={4} marginBottom={2}>
          {icon ? (
            <Icon icon={icon} size={8} intent="primary" />
          ) : (
            <Box width={1} height={8} backgroundColor="var(--ui-color-intent-primary)" />
          )}
          <Heading data-testid="page-header-title" level={1} weight="bold" uppercase letterSpacing="tight">{title}</Heading>
        </Stack>
        {description && (
          <Text variant="low" size="lg" uppercase mono letterSpacing="widest">
            {description}
          </Text>
        )}
      </Box>
      
      {action && (
        <Box display="flex" alignItems="center" paddingBottom={1}>
          {action}
        </Box>
      )}
    </Box>
  );
}
