From 052b7376534df8167c308a4b61aadd10427ab2df Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 20 Jun 2026 11:35:37 +0330 Subject: [PATCH] change design alignmentsetting --- .../sidebar/settings/AlignmentSettings.tsx | 85 ++++++++++++------- 1 file changed, 52 insertions(+), 33 deletions(-) diff --git a/src/pages/editor/components/sidebar/settings/AlignmentSettings.tsx b/src/pages/editor/components/sidebar/settings/AlignmentSettings.tsx index 483a204..706f28e 100644 --- a/src/pages/editor/components/sidebar/settings/AlignmentSettings.tsx +++ b/src/pages/editor/components/sidebar/settings/AlignmentSettings.tsx @@ -1,4 +1,4 @@ - +import type { ReactNode } from "react"; import { AlignBottom, AlignHorizontally, @@ -23,20 +23,40 @@ type AlignmentSettingsProps = { onUpdate: (id: string, updates: Partial) => void; }; +type AlignButtonGroupProps = { + children: ReactNode; +}; +type AlignButtonProps = { + title: string; + onClick: () => void; + children: ReactNode; +}; -const alignIconProps = { size: 24, color: "currentColor" as const, variant: "Linear" as const }; +const AlignButtonGroup = ({ children }: AlignButtonGroupProps) => ( +
+ {children} +
+); + +const AlignButton = ({ title, onClick, children }: AlignButtonProps) => ( + +); + +const alignIconProps = { size: 20, color: "currentColor" as const, variant: "Linear" as const }; const AlignmentSettings = ({ pageWidth, pageHeight, onUpdate, }: AlignmentSettingsProps) => { - // const selectedObjectIds = useEditorStore((s) => s.selectedObjectIds); - - /** دقیقاً دو شیٔ مجزا (هنوز یک گروه نشده‌اند) → مرز همان دو شی؛ یک شی یا گروه یا بیش از دو تا → صفحه */ - // const alignToSelection = selectedObjectIds.length === 2; - const applyAlign = (kind: AlignKind) => { useEditorStore.getState().commitObjectHistoryBeforeChange(); const { objects: objs, selectedObjectIds: ids, layerRef } = useEditorStore.getState(); @@ -79,38 +99,37 @@ const AlignmentSettings = ({ } }; - // const hint = alignToSelection ? "نسبت به دو شی انتخاب‌شده" : "نسبت به صفحه"; - return (
-
-

ابزار جابه‌جایی

- {/*

{hint}

*/} -
+

ترازبندی

-
-

افقی

-
- applyAlign("right")} {...alignIconProps} /> - applyAlign("centerH")} {...alignIconProps} /> - applyAlign("left")} {...alignIconProps} /> -
-
+
+ + applyAlign("right")}> + + + applyAlign("centerH")}> + + + applyAlign("left")}> + + + -
-

عمودی

-
- - applyAlign("top")} {...alignIconProps} /> - - applyAlign("centerV")} {...alignIconProps} /> - - applyAlign("bottom")} {...alignIconProps} /> - -
+ + applyAlign("top")}> + + + applyAlign("centerV")}> + + + applyAlign("bottom")}> + + +
); }; -export default AlignmentSettings; \ No newline at end of file +export default AlignmentSettings;