website refactor
This commit is contained in:
39
apps/website/ui/InlinePenaltyButton.tsx
Normal file
39
apps/website/ui/InlinePenaltyButton.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
import { IconButton } from '@/ui/IconButton';
|
||||
import { AlertTriangle } from 'lucide-react';
|
||||
|
||||
interface DriverDTO {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface InlinePenaltyButtonProps {
|
||||
driver: DriverDTO;
|
||||
onPenaltyClick?: (driver: DriverDTO) => void;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
export function InlinePenaltyButton({
|
||||
driver,
|
||||
onPenaltyClick,
|
||||
isAdmin,
|
||||
}: InlinePenaltyButtonProps) {
|
||||
if (!isAdmin) return null;
|
||||
|
||||
const handleButtonClick = () => {
|
||||
if (onPenaltyClick) {
|
||||
onPenaltyClick(driver);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<IconButton
|
||||
variant="danger"
|
||||
icon={AlertTriangle}
|
||||
onClick={handleButtonClick}
|
||||
title={`Issue penalty to ${driver.name}`}
|
||||
size="sm"
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user