Files
upload-gltf/components/upload/ActionButtons.tsx
T

65 lines
1.8 KiB
TypeScript

interface ActionButtonsProps {
isUploading: boolean
isSecretEmpty: boolean
hasPendingOrErrors: boolean
allDone: boolean
hasErrors: boolean
onUpload: () => void
onCancel: () => void
onReset: () => void
}
export default function ActionButtons({
isUploading,
isSecretEmpty,
hasPendingOrErrors,
allDone,
hasErrors,
onUpload,
onCancel,
onReset,
}: ActionButtonsProps) {
const cantUpload = isSecretEmpty
return (
<div className="flex gap-3">
{!isUploading && hasPendingOrErrors && (
<button
onClick={onUpload}
disabled={cantUpload}
className={`flex-1 font-medium text-sm py-2.5 px-6 rounded-xl transition-all duration-150
focus:outline-none focus:ring-2 focus:ring-white/50 border border-white/20
${cantUpload
? 'bg-white/30 text-gray-500 cursor-not-allowed'
: 'bg-white text-[#000000] hover:bg-gray-200'
}`}
>
Envoyer
</button>
)}
{isUploading && (
<button
onClick={onCancel}
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
py-2.5 px-6 rounded-xl border border-black-600 transition-colors duration-150
hover:bg-black-600"
>
Annuler
</button>
)}
{(allDone || hasErrors) && !isUploading && (
<button
onClick={onReset}
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
py-2.5 px-6 rounded-xl border border-black-600 transition-colors duration-150
hover:bg-black-600"
>
{allDone ? 'Tout effacer' : 'Reessayer'}
</button>
)}
</div>
)
}