From 7f7dde7b280bc5fb333ffe377f985d91dbae841c Mon Sep 17 00:00:00 2001 From: Saidakrom Rakhmedov Date: Sat, 1 Feb 2025 20:53:51 +0500 Subject: [PATCH] Add replace icon --- .../components/cover-button/index.tsx | 5 +- src/pages/root/steps/data-step/index.tsx | 50 +++++++++++-------- src/shared/ui/icons/replace.tsx | 9 ++++ 3 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 src/shared/ui/icons/replace.tsx diff --git a/src/pages/root/steps/data-step/components/cover-button/index.tsx b/src/pages/root/steps/data-step/components/cover-button/index.tsx index 2b3d339..e0b9aa1 100644 --- a/src/pages/root/steps/data-step/components/cover-button/index.tsx +++ b/src/pages/root/steps/data-step/components/cover-button/index.tsx @@ -1,4 +1,5 @@ import { useHapticFeedback } from "@vkruglikov/react-telegram-web-app"; +import { Replace } from "~/shared/ui/icons/replace"; import { XMark } from "~/shared/ui/icons/x-mark.tsx"; @@ -36,8 +37,8 @@ export const CoverButton = ({ src, onClick }: CoverButtonProps) => { } >
-
Удалить
- +
Изменить
+
); diff --git a/src/pages/root/steps/data-step/index.tsx b/src/pages/root/steps/data-step/index.tsx index a601b98..c467205 100644 --- a/src/pages/root/steps/data-step/index.tsx +++ b/src/pages/root/steps/data-step/index.tsx @@ -15,6 +15,7 @@ import { Checkbox } from "~/shared/ui/checkbox"; import { AudioPlayer } from "~/shared/ui/audio-player"; import { HashtagInput } from "~/shared/ui/hashtag-input"; import { XMark } from "~/shared/ui/icons/x-mark"; +import { Replace } from "~/shared/ui/icons/replace"; type DataStepProps = { nextStep(): void; @@ -95,18 +96,20 @@ export const DataStep = ({ nextStep }: DataStepProps) => { - { - rootStore.setFile(file); - rootStore.setFileSrc(URL.createObjectURL(file)); - rootStore.setFileType(file.type); // Save the file type for conditional rendering - }} - /> + {!rootStore.fileSrc && <> + { + rootStore.setFile(file); + rootStore.setFileSrc(URL.createObjectURL(file)); + rootStore.setFileType(file.type); // Save the file type for conditional rendering + }} + /> - {!rootStore.fileSrc && } + + } {rootStore.fileSrc && (
{
)} @@ -151,13 +156,7 @@ export const DataStep = ({ nextStep }: DataStepProps) => { {rootStore.allowCover && ( - { - rootStore.setCover(cover); - }} - /> + {rootStore.cover ? ( { }} /> ) : ( - + <> + { + rootStore.setCover(cover); + }} + /> + + )} )} diff --git a/src/shared/ui/icons/replace.tsx b/src/shared/ui/icons/replace.tsx new file mode 100644 index 0000000..c256953 --- /dev/null +++ b/src/shared/ui/icons/replace.tsx @@ -0,0 +1,9 @@ +export const Replace = () => { + return ( + + + + + + ); +};