From 343b88fc57f045c4af3a26803ec34d5faad2c487 Mon Sep 17 00:00:00 2001 From: JOYCEQL <1449239013@qq.com> Date: Wed, 4 Dec 2024 19:23:47 +0800 Subject: [PATCH] style: EditorPanel && SidePanel color --- .../src/components/editor/EditPanel.tsx | 69 +++++++++++++------ .../src/components/editor/EducationPanel.tsx | 0 apps/fronted/src/components/editor/Field.tsx | 1 - .../src/components/editor/SidePanel.tsx | 25 +++---- 4 files changed, 58 insertions(+), 37 deletions(-) delete mode 100644 apps/fronted/src/components/editor/EducationPanel.tsx diff --git a/apps/fronted/src/components/editor/EditPanel.tsx b/apps/fronted/src/components/editor/EditPanel.tsx index 0bacb1f..c161ba3 100644 --- a/apps/fronted/src/components/editor/EditPanel.tsx +++ b/apps/fronted/src/components/editor/EditPanel.tsx @@ -1,6 +1,6 @@ "use client"; - import React from "react"; +import { Pencil } from "lucide-react"; import { motion } from "framer-motion"; import { useResumeStore } from "@/store/useResumeStore"; import { cn } from "@/lib/utils"; @@ -10,6 +10,12 @@ import ProjectPanel from "./project/ProjectPanel"; import ExperiencePanel from "./experience/ExperiencePanel"; import CustomPanel from "./custom/CustomPanel"; import SkillPanel from "./skills/SkillPanel"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger +} from "../ui/tooltip"; export function EditPanel() { const { activeSection, menuSections, updateMenuSections } = useResumeStore(); @@ -56,26 +62,49 @@ export function EditPanel() { {menuSections?.find((s) => s.id === activeSection)?.icon} - s.id === activeSection)?.title} - onChange={(e) => { - const newMenuSections = menuSections.map((s) => { - if (s.id === activeSection) { - return { - ...s, - title: e.target.value - }; + + {/* 如果是基本信息的展示话展示div */} + {activeSection === "basic" ? ( +
+ + {menuSections?.find((s) => s.id === activeSection)?.title} + +
+ ) : ( + <> + s.id === activeSection)?.title } - return s; - }); - updateMenuSections(newMenuSections); - }} - /> + onChange={(e) => { + const newMenuSections = menuSections.map((s) => { + if (s.id === activeSection) { + return { + ...s, + title: e.target.value + }; + } + return s; + }); + updateMenuSections(newMenuSections); + }} + /> + + + + + + +

点击文字部分即可聚焦编辑

+
+
+
+ + )} diff --git a/apps/fronted/src/components/editor/EducationPanel.tsx b/apps/fronted/src/components/editor/EducationPanel.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/apps/fronted/src/components/editor/Field.tsx b/apps/fronted/src/components/editor/Field.tsx index 85e8cc3..2b400d5 100644 --- a/apps/fronted/src/components/editor/Field.tsx +++ b/apps/fronted/src/components/editor/Field.tsx @@ -10,7 +10,6 @@ import { } from "@/components/ui/popover"; import { Calendar } from "@/components/ui/calendar"; import { Input } from "@/components/ui/input"; -import { useResumeStore } from "@/store/useResumeStore"; import RichTextEditor from "@/components/shared/rich-editor/RichEditor"; import { Button } from "../ui/button"; diff --git a/apps/fronted/src/components/editor/SidePanel.tsx b/apps/fronted/src/components/editor/SidePanel.tsx index 478030f..59fe9ea 100644 --- a/apps/fronted/src/components/editor/SidePanel.tsx +++ b/apps/fronted/src/components/editor/SidePanel.tsx @@ -84,7 +84,8 @@ export function SidePanel() { colorTheme, setColorTheme, updateMenuSections, - addCustomData + addCustomData, + activeSection } = useResumeStore(); const debouncedSetColor = useMemo( @@ -135,9 +136,10 @@ export function SidePanel() {
@@ -151,12 +153,7 @@ export function SidePanel() { {item.icon} setActiveSection(item.id)} > {item.title} @@ -180,7 +177,8 @@ export function SidePanel() { className={cn( "rounded-lg cursor-move group border hover:border-primary", "dark:hover:bg-neutral-800 dark:bg-neutral-900/50 dark:border-neutral-800 dark:hover:border-primary", - "hover:bg-gray-50 bg-white border-gray-100 " + "hover:bg-gray-50 bg-white border-gray-100", + activeSection === item.id && "border-primary text-primary" )} whileHover={{ scale: 1.01 }} whileDrag={{ scale: 1.02 }} @@ -203,12 +201,7 @@ export function SidePanel() { {item.icon} setActiveSection(item.id)} > {item.title}