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

69 lines
2.0 KiB
TypeScript

interface ActionButtonsProps {
isUploading: boolean
isChecking: boolean
isSecretEmpty: boolean
hasPendingOrErrors: boolean
allDone: boolean
hasErrors: boolean
onUpload: () => void
onCancel: () => void
onReset: () => void
}
export default function ActionButtons({
isUploading,
isChecking,
isSecretEmpty,
hasPendingOrErrors,
allDone,
hasErrors,
onUpload,
onCancel,
onReset,
}: ActionButtonsProps) {
const cantUpload = isSecretEmpty || isChecking
const isBusy = isUploading || isChecking
return (
<div className="flex gap-3">
{!isBusy && 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>
)}
{isBusy && (
<button
onClick={onCancel}
disabled={!isUploading}
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 disabled:opacity-50 disabled:cursor-not-allowed
hover:bg-black-600"
>
{isChecking ? 'Verification...' : 'Annuler'}
</button>
)}
{(allDone || hasErrors) && !isBusy && (
<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>
)
}