From faecbbb8572b0e6e0f95f3080cbfa7de0ca44bc6 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 6 Sep 2024 15:50:06 +0800 Subject: [PATCH] refactor: Remove unused CSS classes and optimize conditional styling - Removed unused CSS classes and optimized code for conditional styling. --- src/renderer/src/pages/home/Markdown/CodeBlock.tsx | 10 ++++++++-- src/renderer/src/pages/home/Topics.tsx | 10 ++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/pages/home/Markdown/CodeBlock.tsx b/src/renderer/src/pages/home/Markdown/CodeBlock.tsx index 48103ac466..0b9fb122fe 100644 --- a/src/renderer/src/pages/home/Markdown/CodeBlock.tsx +++ b/src/renderer/src/pages/home/Markdown/CodeBlock.tsx @@ -48,7 +48,13 @@ const CodeBlock: React.FC = ({ children, className, ...rest }) = language={match[1]} style={theme === ThemeMode.dark ? atomDark : oneLight} wrapLongLines={true} - customStyle={{ borderTopLeftRadius: 0, borderTopRightRadius: 0, marginTop: 0 }}> + customStyle={{ + borderTopLeftRadius: 0, + borderTopRightRadius: 0, + marginTop: 0, + border: '0.5px solid var(--color-code-background)', + borderTop: 'none' + }}> {String(children).replace(/\n$/, '')} @@ -57,7 +63,7 @@ const CodeBlock: React.FC = ({ children, className, ...rest }) = {...rest} style={theme === ThemeMode.dark ? atomDark : oneLight} wrapLongLines={true} - customStyle={{ border: '0.5px solid var(--color-border)', padding: '8px 12px' }}> + customStyle={{ border: '0.5px solid var(--color-code-background)', padding: '8px 12px' }}> {String(children).replace(/\n$/, '')} ) diff --git a/src/renderer/src/pages/home/Topics.tsx b/src/renderer/src/pages/home/Topics.tsx index f8345b0c52..1e47ab9f44 100644 --- a/src/renderer/src/pages/home/Topics.tsx +++ b/src/renderer/src/pages/home/Topics.tsx @@ -96,10 +96,9 @@ const Topics: FC = ({ assistant: _assistant, activeTopic, setActiveTopic {(topic) => { const isActive = topic.id === activeTopic?.id - const activeClass = topicPosition === 'left' ? 'active-left' : 'active-right' return ( - onSwitchTopic(topic)}> + onSwitchTopic(topic)}> {topic.name} @@ -134,12 +133,7 @@ const TopicListItem = styled.div` &:hover { background-color: var(--color-background-soft); } - &.active-left { - background-color: var(--color-primary); - color: white; - font-weight: 500; - } - &.active-right { + &.active { background-color: var(--color-background-mute); font-weight: 500; }