'use client';

import { Heading } from '@/ui/Heading';
import { Text } from '@/ui/Text';
import { Group } from '@/ui/Group';
import { Table, TableHead, TableBody, TableRow, TableHeaderCell } from '@/ui/Table';
import { TrendingUp } from 'lucide-react';
import { Card } from '@/ui/Card';
import { Icon } from '@/ui/Icon';
import React from 'react';

interface DriverTableProps {
  children: React.ReactNode;
}

export function DriverTable({ children }: DriverTableProps) {
  return (
    <Group direction="column" gap={4} fullWidth>
      <Group direction="row" align="center" gap={3}>
        <Card variant="dark">
          <Icon icon={TrendingUp} size={5} intent="primary" />
        </Card>
        <Group direction="column">
          <Heading level={2}>Driver Rankings</Heading>
          <Text size="xs" variant="low">Top performers by skill rating</Text>
        </Group>
      </Group>

      <Table>
        <TableHead>
          <TableRow>
            <TableHeaderCell textAlign="center" w="60px">#</TableHeaderCell>
            <TableHeaderCell>Driver</TableHeaderCell>
            <TableHeaderCell w="150px">Nationality</TableHeaderCell>
            <TableHeaderCell textAlign="right" w="100px">Rating</TableHeaderCell>
            <TableHeaderCell textAlign="right" w="80px">Wins</TableHeaderCell>
          </TableRow>
        </TableHead>
        <TableBody>
          {children}
        </TableBody>
      </Table>
    </Group>
  );
}
