mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
perf: code pref
This commit is contained in:
@@ -15,7 +15,7 @@ import { useResumeStore } from "@/store/useResumeStore";
|
||||
import { EditorHeader } from "@/components/editor/EditorHeader";
|
||||
import { SidePanel } from "@/components/editor/SidePanel";
|
||||
import { EditPanel } from "@/components/editor/EditPanel";
|
||||
import { PreviewPanel } from "@/components/editor/PreviewPanel";
|
||||
import { PreviewPanel } from "@/components/preview/PreviewPanel";
|
||||
import { getThemeConfig } from "@/theme/themeConfig";
|
||||
import { useScrollbarTheme } from "@/hooks/useScrollBarTheme";
|
||||
import {
|
||||
|
||||
@@ -17,8 +17,6 @@ import {
|
||||
LucideIcon
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import Field from "../Field";
|
||||
import { useResumeStore } from "@/store/useResumeStore";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -27,7 +25,7 @@ import {
|
||||
PopoverContent,
|
||||
PopoverTrigger
|
||||
} from "@/components/ui/popover";
|
||||
import { motion, Reorder } from "framer-motion";
|
||||
import { Reorder } from "framer-motion";
|
||||
|
||||
type IconOption = {
|
||||
label: string;
|
||||
@@ -68,6 +66,7 @@ interface BasicInfo {
|
||||
employed?: boolean;
|
||||
customFields?: CustomFieldType[];
|
||||
icons?: Record<string, string>;
|
||||
employementStatus?: string;
|
||||
}
|
||||
|
||||
const iconOptions: IconOption[] = [
|
||||
@@ -285,31 +284,7 @@ const BasicPanel: React.FC = () => {
|
||||
<div className="space-y-5 p-4">
|
||||
<div className="flex justify-between items-start gap-4">
|
||||
<div className="flex-1">{renderField("name", "姓名")}</div>
|
||||
<div className="flex items-center gap-2 pt-8">
|
||||
<Switch
|
||||
id="employed"
|
||||
checked={basic?.employed ?? true}
|
||||
onCheckedChange={(checked) =>
|
||||
updateBasicInfo({
|
||||
...basic,
|
||||
employed: checked
|
||||
})
|
||||
}
|
||||
className={cn(
|
||||
theme === "dark" ? "bg-neutral-700" : "bg-neutral-200",
|
||||
"data-[state=checked]:bg-green-500"
|
||||
)}
|
||||
/>
|
||||
<Label
|
||||
htmlFor="employed"
|
||||
className={cn(
|
||||
"text-sm cursor-pointer select-none",
|
||||
theme === "dark" ? "text-neutral-200" : "text-neutral-700"
|
||||
)}
|
||||
>
|
||||
{basic?.employed ?? true ? "在职" : "离职"}
|
||||
</Label>
|
||||
</div>
|
||||
<div>{renderField("employementStatus", "在职状态")}</div>
|
||||
</div>
|
||||
{renderField("title", "职位")}
|
||||
{renderField("birthDate", "出生日期", { type: "date" })}
|
||||
@@ -340,7 +315,6 @@ const BasicPanel: React.FC = () => {
|
||||
))}
|
||||
</Reorder.Group>
|
||||
|
||||
{/* 添加按钮 */}
|
||||
<Button
|
||||
onClick={addCustomField}
|
||||
className={cn(
|
||||
|
||||
+2
-2
@@ -471,7 +471,7 @@ export function PreviewPanel() {
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
>
|
||||
<div className="py-8 px-4 min-h-screen flex justify-center">
|
||||
<div className="py-4 px-4 min-h-screen flex justify-center">
|
||||
<motion.div
|
||||
layout
|
||||
className={cn(
|
||||
@@ -526,7 +526,7 @@ export function PreviewPanel() {
|
||||
basic.birthDate
|
||||
? new Date(basic.birthDate).toLocaleDateString()
|
||||
: "",
|
||||
...(basic.customFields?.map((field) => field.value) || []) // 添加自定义字段的值
|
||||
...(basic.customFields?.map((field) => field.value) || [])
|
||||
]
|
||||
.filter(Boolean)
|
||||
.map((item, index, array) => (
|
||||
@@ -1,14 +1,11 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import {
|
||||
ResumeData,
|
||||
ResumeSection,
|
||||
BasicInfo,
|
||||
Education,
|
||||
Experience,
|
||||
GlobalSettings,
|
||||
Project,
|
||||
ResumeTheme
|
||||
Project
|
||||
} from "../types/resume";
|
||||
|
||||
interface ResumeStore {
|
||||
|
||||
@@ -50,24 +50,6 @@ export interface Project {
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
export interface ResumeSection {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: string;
|
||||
type: "basic" | "education" | "experience" | "skills" | "projects";
|
||||
}
|
||||
|
||||
export interface ResumeData {
|
||||
basic: BasicInfo;
|
||||
education: Education[];
|
||||
experience: Experience[];
|
||||
skills: Skill[];
|
||||
projects: Project[];
|
||||
sections: ResumeSection[];
|
||||
activeSection: string;
|
||||
theme: "light" | "dark";
|
||||
}
|
||||
|
||||
export type GlobalSettings = {
|
||||
theme: "light" | "dark";
|
||||
themeColor: string;
|
||||
@@ -77,23 +59,6 @@ export type GlobalSettings = {
|
||||
paragraphSpacing: number;
|
||||
};
|
||||
|
||||
export interface ThemeColors {
|
||||
primary: string; // 主色
|
||||
secondary: string; // 次要色
|
||||
text: {
|
||||
primary: string; // 主要文字颜色
|
||||
secondary: string; // 次要文字颜色
|
||||
accent: string; // 强调文字颜色
|
||||
};
|
||||
background: {
|
||||
primary: string; // 主要背景色
|
||||
secondary: string; // 次要背景色
|
||||
accent: string; // 强调背景色
|
||||
};
|
||||
border: string; // 边框颜色
|
||||
divider: string; // 分割线颜色
|
||||
}
|
||||
|
||||
export interface ResumeTheme {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user