From b94e22fd452f869e11c65943c9879fe99bcbfe57 Mon Sep 17 00:00:00 2001 From: JOYCEQL <1449239013@qq.com> Date: Fri, 7 Mar 2025 14:22:20 +0800 Subject: [PATCH] perf: simplify subtitle rendering logic and ensure date display consistency across sections --- src/components/preview/CustomSection.tsx | 10 ++++------ src/components/preview/ExperienceSection.tsx | 6 ++---- src/components/preview/ProjectSection.tsx | 6 ++---- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/components/preview/CustomSection.tsx b/src/components/preview/CustomSection.tsx index f079e6a..4a99b8f 100644 --- a/src/components/preview/CustomSection.tsx +++ b/src/components/preview/CustomSection.tsx @@ -67,17 +67,15 @@ const CustomSection = ({ - {centerSubtitle && item.subtitle && ( + {centerSubtitle && ( {item.subtitle} )} - { - - {item.dateRange} - - } + + {item.dateRange} + {!centerSubtitle && item.subtitle && ( diff --git a/src/components/preview/ExperienceSection.tsx b/src/components/preview/ExperienceSection.tsx index d292d30..0eea014 100644 --- a/src/components/preview/ExperienceSection.tsx +++ b/src/components/preview/ExperienceSection.tsx @@ -37,14 +37,12 @@ const ExperienceItem = React.forwardRef( > {experience.company} - {experience.position && centerSubtitle && ( + {centerSubtitle && ( {experience.position} )} - {experience.date && ( -
{experience.date}
- )} +
{experience.date}
{experience.position && !centerSubtitle && ( diff --git a/src/components/preview/ProjectSection.tsx b/src/components/preview/ProjectSection.tsx index ca53699..fe78756 100644 --- a/src/components/preview/ProjectSection.tsx +++ b/src/components/preview/ProjectSection.tsx @@ -51,14 +51,12 @@ const ProjectItem = React.forwardRef( )} - {project.role && globalSettings?.centerSubtitle && ( + {globalSettings?.centerSubtitle && ( {project.role} )} - {project.date && ( -
{project.date}
- )} +
{project.date}
{project.role && !centerSubtitle && (