styles fix

This commit is contained in:
rngsurrounded
2025-03-03 06:06:45 +09:00
parent 3016f21f13
commit 8b77797377
@@ -20,7 +20,6 @@ const FileSolution: React.FC<FileSolutionProps> = ({
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files && event.target.files[0]) { if (event.target.files && event.target.files[0]) {
setSelectedFile(event.target.files[0]); setSelectedFile(event.target.files[0]);
// Clear existing file URL when a new file is selected
if (existingFileUrl && onClearExistingFile) { if (existingFileUrl && onClearExistingFile) {
onClearExistingFile(); onClearExistingFile();
} }
@@ -47,25 +46,20 @@ const FileSolution: React.FC<FileSolutionProps> = ({
if (e.dataTransfer.files && e.dataTransfer.files[0]) { if (e.dataTransfer.files && e.dataTransfer.files[0]) {
setSelectedFile(e.dataTransfer.files[0]); setSelectedFile(e.dataTransfer.files[0]);
// Clear existing file URL when a new file is dropped
if (existingFileUrl && onClearExistingFile) { if (existingFileUrl && onClearExistingFile) {
onClearExistingFile(); onClearExistingFile();
} }
} }
}; };
// Handle clearing the file
const handleClearFile = () => { const handleClearFile = () => {
setSelectedFile(null); setSelectedFile(null);
// Also clear the existing file URL if it exists
if (existingFileUrl && onClearExistingFile) { if (existingFileUrl && onClearExistingFile) {
onClearExistingFile(); onClearExistingFile();
} }
}; };
// Handle selecting a new file when an existing file is shown
const handleSelectNewFile = () => { const handleSelectNewFile = () => {
// Just trigger the file input click - the actual clearing will happen in handleFileChange
fileInputRef.current?.click(); fileInputRef.current?.click();
}; };
@@ -98,7 +92,7 @@ const FileSolution: React.FC<FileSolutionProps> = ({
<a <a
href={existingFileUrl} href={existingFileUrl}
download download
className="flex items-center text-blue-500 text-sm mr-3 hover:text-blue-600" className="flex items-center "
> >
<Download size={16} className="mr-1" /> <Download size={16} className="mr-1" />
Скачать Скачать
@@ -108,7 +102,7 @@ const FileSolution: React.FC<FileSolutionProps> = ({
{selectedFile ? ( {selectedFile ? (
<Button <Button
variant="ghost" variant="ghost"
className="text-blue-500 text-sm p-0 h-auto hover:bg-transparent hover:text-blue-600 font-hse-sans" className="text-sm p-0 h-auto hover:bg-transparent font-hse-sans"
onClick={handleClearFile} onClick={handleClearFile}
> >
Очистить Очистить
@@ -117,14 +111,14 @@ const FileSolution: React.FC<FileSolutionProps> = ({
<div className="flex gap-3"> <div className="flex gap-3">
<Button <Button
variant="ghost" variant="ghost"
className="text-blue-500 text-sm p-0 h-auto hover:bg-transparent hover:text-blue-600 font-hse-sans" className="text-sm p-0 h-auto hover:bg-transparent font-hse-sans"
onClick={handleSelectNewFile} onClick={handleSelectNewFile}
> >
Выбрать другой файл Выбрать другой файл
</Button> </Button>
<Button <Button
variant="ghost" variant="ghost"
className="text-red-500 text-sm p-0 h-auto hover:bg-transparent hover:text-red-600 font-hse-sans" className="text-sm p-0 h-auto hover:bg-transparent font-hse-sans"
onClick={handleClearFile} onClick={handleClearFile}
> >
Очистить Очистить