nav-next/components/tools/hash-random/ParticipantList.tsx
2024-12-27 19:27:49 +08:00

41 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useState } from 'react'
interface ParticipantListProps {
setParticipants: (participants: string[]) => void
}
export default function ParticipantList({ setParticipants }: ParticipantListProps) {
const [participantText, setParticipantText] = useState('')
const handleRoll = () => {
const participantArray = participantText.split(/[\n\s]+/).filter(Boolean)
setParticipants(participantArray)
}
return (
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 transition-colors duration-200">
<h2 className="text-2xl font-bold mb-4 text-indigo-800 dark:text-indigo-200"></h2>
<div className="space-y-4">
<div>
<label htmlFor="participants" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
</label>
<textarea
id="participants"
value={participantText}
onChange={(e) => setParticipantText(e.target.value)}
className="w-full h-32 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white"
/>
</div>
<button
onClick={handleRoll}
className="w-full bg-indigo-600 text-white px-4 py-2 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors"
>
</button>
</div>
</div>
)
}