mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
style: editor && preview style
This commit is contained in:
@@ -454,7 +454,7 @@ export function SidePanel() {
|
||||
<div className="flex items-center gap-4">
|
||||
<Slider
|
||||
value={[globalSettings?.sectionSpacing || 0]}
|
||||
min={20}
|
||||
min={1}
|
||||
max={100}
|
||||
step={1}
|
||||
onValueChange={([value]) =>
|
||||
|
||||
@@ -23,14 +23,7 @@ const DEFAULT_FIELD_ORDER: BasicFieldType[] = [
|
||||
{ id: "4", key: "birthDate", label: "出生日期", type: "date", visible: true },
|
||||
{ id: "5", key: "email", label: "电子邮箱", type: "text", visible: true },
|
||||
{ id: "6", key: "phone", label: "电话", type: "text", visible: true },
|
||||
{ id: "7", key: "location", label: "所在地", type: "text", visible: true },
|
||||
{
|
||||
id: "8",
|
||||
key: "summary",
|
||||
label: "个人简介",
|
||||
type: "textarea",
|
||||
visible: true
|
||||
}
|
||||
{ id: "7", key: "location", label: "所在地", type: "text", visible: true }
|
||||
];
|
||||
|
||||
interface CustomFieldProps {
|
||||
@@ -158,15 +151,6 @@ const BasicPanel: React.FC = () => {
|
||||
}));
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!basic.fieldOrder) {
|
||||
updateBasicInfo({
|
||||
...basic,
|
||||
fieldOrder: DEFAULT_FIELD_ORDER
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleBasicReorder = (newOrder: BasicFieldType[]) => {
|
||||
setBasicFields(newOrder);
|
||||
updateBasicInfo({
|
||||
|
||||
@@ -20,7 +20,6 @@ export function EducationSection({
|
||||
return (
|
||||
<motion.div
|
||||
layout
|
||||
className="space-y-4"
|
||||
style={{
|
||||
marginTop: `${globalSettings?.sectionSpacing || 24}px`
|
||||
}}
|
||||
@@ -33,7 +32,6 @@ export function EducationSection({
|
||||
{visibleEducation.map((edu) => (
|
||||
<div
|
||||
key={edu.id}
|
||||
className="space-y-2"
|
||||
style={{
|
||||
marginTop: `${globalSettings?.paragraphSpacing}px`
|
||||
}}
|
||||
|
||||
@@ -16,7 +16,6 @@ export function ExperienceSection({
|
||||
return (
|
||||
<motion.div
|
||||
layout
|
||||
className="space-y-4"
|
||||
style={{
|
||||
marginTop: `${globalSettings?.sectionSpacing || 24}px`
|
||||
}}
|
||||
@@ -29,7 +28,6 @@ export function ExperienceSection({
|
||||
{experience.map((exp) => (
|
||||
<div
|
||||
key={exp.id}
|
||||
className="space-y-2"
|
||||
style={{
|
||||
marginTop: `${globalSettings?.paragraphSpacing}px`
|
||||
}}
|
||||
|
||||
@@ -159,9 +159,8 @@ export function PreviewPanel() {
|
||||
<LayoutGroup>
|
||||
<motion.div
|
||||
layout
|
||||
className="space-y-4"
|
||||
style={{
|
||||
marginTop: `${globalSettings?.paragraphSpacing || 20}px`
|
||||
marginTop: `${globalSettings?.sectionSpacing || 24}px`
|
||||
}}
|
||||
>
|
||||
<SectionTitle
|
||||
@@ -196,29 +195,8 @@ export function PreviewPanel() {
|
||||
return Math.max(0, Math.ceil(contentHeight / pageHeightPx) - 1);
|
||||
}, [contentHeight]);
|
||||
|
||||
const renderBasicInfo = () => (
|
||||
<motion.div layout className="space-y-2">
|
||||
<SectionTitle
|
||||
title="个人简介"
|
||||
themeColor={currentThemeColor}
|
||||
globalSettings={globalSettings}
|
||||
/>
|
||||
<p
|
||||
className="text-gray-600 whitespace-pre-wrap"
|
||||
style={{
|
||||
fontSize: `${globalSettings?.baseFontSize || 14}px`,
|
||||
lineHeight: globalSettings?.lineHeight || 1.6
|
||||
}}
|
||||
>
|
||||
{basic.summary}
|
||||
</p>
|
||||
</motion.div>
|
||||
);
|
||||
|
||||
const renderSection = (sectionId: string) => {
|
||||
switch (sectionId) {
|
||||
case "basic":
|
||||
return renderBasicInfo();
|
||||
case "education":
|
||||
return (
|
||||
<EducationSection
|
||||
@@ -272,7 +250,7 @@ export function PreviewPanel() {
|
||||
id="resume-preview"
|
||||
>
|
||||
<LayoutGroup>
|
||||
<motion.div layout className="space-y-8" ref={resumeContentRef}>
|
||||
<motion.div layout ref={resumeContentRef}>
|
||||
<BaseInfo basic={basic} globalSettings={globalSettings} />
|
||||
{menuSections
|
||||
.filter((section) => section.enabled)
|
||||
|
||||
@@ -33,10 +33,7 @@ export function ProjectItem({
|
||||
damping: 50,
|
||||
mass: 1
|
||||
}}
|
||||
className={cn(
|
||||
"space-y-2 relative rounded-lg p-4 pl-0",
|
||||
isDragging && "z-10"
|
||||
)}
|
||||
className={cn("relative rounded-lg pl-0", isDragging && "z-10")}
|
||||
style={{
|
||||
marginTop: `${globalSettings?.paragraphSpacing}px`
|
||||
}}
|
||||
|
||||
@@ -63,7 +63,6 @@ const initialState = {
|
||||
email: "example@email.com",
|
||||
phone: "13800138000",
|
||||
location: "北京市",
|
||||
summary: "5年前端开发经验...",
|
||||
birthDate: "",
|
||||
icons: {},
|
||||
photoConfig: DEFAULT_CONFIG,
|
||||
@@ -165,8 +164,10 @@ export const useResumeStore = create<ResumeStore>()(
|
||||
|
||||
setDraggingProjectId: (id) => set({ draggingProjectId: id }),
|
||||
|
||||
updateBasicInfo: (data) =>
|
||||
set((state) => ({ basic: { ...state.basic, ...data } })),
|
||||
updateBasicInfo: (data) => {
|
||||
console.log(data, "data");
|
||||
set((state) => ({ basic: { ...state.basic, ...data } }));
|
||||
},
|
||||
|
||||
updateExperience: (id, data) =>
|
||||
set((state) => ({
|
||||
|
||||
@@ -66,7 +66,6 @@ export interface BasicInfo {
|
||||
email: string;
|
||||
phone: string;
|
||||
location: string;
|
||||
summary: string;
|
||||
icons: Record<string, string>;
|
||||
employementStatus: string;
|
||||
photo: string;
|
||||
|
||||
Reference in New Issue
Block a user