add reset attachment

This commit is contained in:
Saidakrom Rakhmedov 2025-02-01 20:21:56 +05:00
parent 372f84d1b1
commit 1d22ac2173
2 changed files with 119 additions and 104 deletions

View File

@ -14,6 +14,7 @@ import { useRootStore } from "~/shared/stores/root";
import { Checkbox } from "~/shared/ui/checkbox"; import { Checkbox } from "~/shared/ui/checkbox";
import { AudioPlayer } from "~/shared/ui/audio-player"; import { AudioPlayer } from "~/shared/ui/audio-player";
import { HashtagInput } from "~/shared/ui/hashtag-input"; import { HashtagInput } from "~/shared/ui/hashtag-input";
import { XMark } from "~/shared/ui/icons/x-mark";
type DataStepProps = { type DataStepProps = {
nextStep(): void; nextStep(): void;
@ -57,6 +58,12 @@ export const DataStep = ({ nextStep }: DataStepProps) => {
})(); })();
}; };
const handleFileReset = () => {
rootStore.setFile(null);
rootStore.setFileSrc('');
rootStore.setFileType('');
}
return ( return (
<section className={"mt-4 px-4 pb-8"}> <section className={"mt-4 px-4 pb-8"}>
<div className={"mb-[30px] flex flex-col text-sm"}> <div className={"mb-[30px] flex flex-col text-sm"}>
@ -118,6 +125,14 @@ export const DataStep = ({ nextStep }: DataStepProps) => {
url={rootStore.fileSrc} url={rootStore.fileSrc}
/> />
)} )}
<button
onClick={handleFileReset}
className={
"text-center w-full gap-1 border border-white px-[10px] py-[8px] mt-2 text-sm"
}
>
Изменить выбор
</button>
</div> </div>
)} )}
</FormLabel> </FormLabel>

View File

@ -13,7 +13,7 @@ type RootStore = {
setAuthor: (author: string) => void; setAuthor: (author: string) => void;
file: File | null; file: File | null;
setFile: (file: File) => void; setFile: (file: File | null) => void;
fileType: string; fileType: string;
setFileType: (type: string) => void; setFileType: (type: string) => void;