From 5652ed2070d2d202a30f55c48d8d92325a946670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B4=D0=B5=D0=B6=D0=B4=D0=B0?= Date: Wed, 7 Aug 2024 20:26:57 +0300 Subject: [PATCH] =?UTF-8?q?cropmodal=20=D0=B4=D0=B5=D1=81=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=BF=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/AmoTrash.tsx | 26 ++++ src/ui_kit/Modal/CropModal/CropGeneral.tsx | 124 ++++++++++-------- .../Modal/CropModal/NavigationPanel.tsx | 9 +- src/ui_kit/Modal/CropModal/WorkSpace.tsx | 69 ++++++---- 4 files changed, 145 insertions(+), 83 deletions(-) create mode 100644 src/assets/icons/AmoTrash.tsx diff --git a/src/assets/icons/AmoTrash.tsx b/src/assets/icons/AmoTrash.tsx new file mode 100644 index 00000000..d61e6652 --- /dev/null +++ b/src/assets/icons/AmoTrash.tsx @@ -0,0 +1,26 @@ +import { Box } from "@mui/material"; + +interface Props { + color?: string; + height?: string; + width?: string; +} + +export default function AmoTrash({ color, height, width }: Props) { + return ( + + + + + + + + + ); +} diff --git a/src/ui_kit/Modal/CropModal/CropGeneral.tsx b/src/ui_kit/Modal/CropModal/CropGeneral.tsx index 6f2169c6..7b40a3cb 100644 --- a/src/ui_kit/Modal/CropModal/CropGeneral.tsx +++ b/src/ui_kit/Modal/CropModal/CropGeneral.tsx @@ -29,7 +29,8 @@ import { CropAspectRatio, DEFAULTCROPRULES, EditedImage } from "@/model/CropModa const styleSlider: SxProps = { color: "#7E2AEA", - height: "12px", + height: "10px", + p: "18px 0", "& .MuiSlider-track": { border: "none", }, @@ -38,8 +39,8 @@ const styleSlider: SxProps = { border: `1px solid #9A9AAF`, }, "& .MuiSlider-thumb": { - height: 26, - width: 26, + height: 24, + width: 24, border: `6px solid #7E2AEA`, backgroundColor: "white", boxShadow: `0px 0px 0px 3px white, @@ -74,7 +75,7 @@ export const CropGeneral: FC = ({ async function handleRotateClick() { editedImagesChange((old) => { const newRotate = old.newRules.rotate + 90; - + return { newRules: { ...old.newRules, @@ -100,7 +101,7 @@ export const CropGeneral: FC = ({ imageHeight, ); -//Хз зачем это было нужно, как будет работать - перетещу + //Хз зачем это было нужно, как будет работать - перетещу // if (!old.newRules.crop || old.newRules.crop.height === 0 || old.newRules.crop.width === 0) { // return centerCrop(crop, imageWidth, imageHeight); @@ -114,7 +115,7 @@ export const CropGeneral: FC = ({ 100 - crop.height, Math.max(0, old.newRules.crop.y + (old.newRules.crop.height - crop.height) / 2), ); - + return { newRules: { ...old.newRules, @@ -134,7 +135,8 @@ export const CropGeneral: FC = ({ display: "flex", alignItems: "center", justifyContent: "center", - padding: "0 20px" + padding: "0 20px", + marginTop: "20px", }} > = ({ cropImageElementRef.current?.height, cropAspectRatio ? cropAspectRatio.width / cropAspectRatio.height - : 1, + : 2, ) } })) @@ -180,6 +182,7 @@ export const CropGeneral: FC = ({ style={{ filter: `brightness(${100 - editedImage.newRules.darken}%)`, maxWidth: "100%", + height: "320px", maxHeight: "320px", display: "block", objectFit: "contain", @@ -189,58 +192,73 @@ export const CropGeneral: FC = ({ - + - - - Размер - - { - if (typeof newValue === "number") handleSizeChange(newValue); - }} - /> - - - - Затемнение - - editedImagesChange((old) => ({ - newRules: { - ...old.newRules, - darken: newValue as number - } - }))} - /> + + + + Размер + + { + if (typeof newValue === "number") handleSizeChange(newValue); + }} + /> + + + + Затемнение + + editedImagesChange((old) => ({ + newRules: { + ...old.newRules, + darken: newValue as number + } + }))} + /> + diff --git a/src/ui_kit/Modal/CropModal/NavigationPanel.tsx b/src/ui_kit/Modal/CropModal/NavigationPanel.tsx index 6cd5485e..aad2f58c 100644 --- a/src/ui_kit/Modal/CropModal/NavigationPanel.tsx +++ b/src/ui_kit/Modal/CropModal/NavigationPanel.tsx @@ -41,12 +41,13 @@ export const NavigationPanel: FC = ({ return (