Skip to content

Feat: 优化了filetree的样式#320

Merged
xun082 merged 4 commits intoxun082:mainfrom
Hemomoo:feat-file-tree
Mar 16, 2026
Merged

Feat: 优化了filetree的样式#320
xun082 merged 4 commits intoxun082:mainfrom
Hemomoo:feat-file-tree

Conversation

@Hemomoo
Copy link
Collaborator

@Hemomoo Hemomoo commented Mar 16, 2026

PR 描述

style(文档侧边栏): 统一文件树组件样式为简约风格

移除渐变背景和阴影效果,使用统一的中性色系
调整间距和图标颜色以提升视觉一致性
优化暗黑模式下的颜色对比度

PR 类型

  • 🐛 Bug 修复
  • ✨ 新功能
  • 💄 UI/UX 改进
  • ♻️ 重构
  • 🚀 性能优化
  • 📝 文档更新
  • 🔄 其他

Issue 关联

Closes #

其他信息

邓亮 added 2 commits March 14, 2026 13:02
移除文件侧边栏中的渐变背景和阴影效果,改用更简洁的纯色设计
调整选中状态和悬停状态的样式,统一颜色方案
优化图标和文本的显示效果,提升视觉一致性
移除渐变背景和阴影效果,使用统一的中性色系
调整间距和图标颜色以提升视觉一致性
优化暗黑模式下的颜色对比度
@netlify
Copy link

netlify bot commented Mar 16, 2026

Deploy Preview for ornate-blancmange-89db6b failed. Why did it fail? →

Name Link
🔨 Latest commit 7baae31
🔍 Latest deploy log https://app.netlify.com/projects/ornate-blancmange-89db6b/deploys/69b79ba8d295ea00083de1f3

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过移除复杂的视觉效果(如渐变和强阴影)并采用统一的中性色调,来简化文档侧边栏中文件树组件的整体外观。这些更改不仅提升了组件的视觉一致性,还特别关注了暗黑模式下的用户体验,确保了良好的可读性和美观性。

Highlights

  • 统一文件树组件样式: 移除了文件树组件中的渐变背景和阴影效果,统一采用中性色系,以实现更简约的视觉风格。
  • 优化间距和图标颜色: 调整了文件树项的间距和图标颜色,提升了整体视觉一致性,使其在不同状态下(如选中、悬停)表现更协调。
  • 改进暗黑模式对比度: 针对暗黑模式下的颜色进行了优化,确保了更好的颜色对比度和可读性。
Changelog
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/FileItemMenu.tsx
    • 更新了菜单项(分享、下载、复制、重命名)的文本和悬停背景颜色,改为中性色调。
    • 调整了删除操作的文本和悬停背景颜色,使用特定的红色系。
    • 修改了更多操作按钮的悬停背景和文本颜色,并缩小了图标尺寸。
    • 更新了菜单下拉框的背景、边框、阴影样式,并调整了字体大小。
    • 调整了菜单项按钮的内边距和图标间距。
    • 更新了菜单分隔线的边框颜色。
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/components/ContextMenu.tsx
    • 将“新建文件”、“新建文件夹”和“重命名”图标的背景渐变替换为统一的中性纯色,并调整了图标文本颜色。
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/components/DocumentGroupHeader.tsx
    • 将文档分组标题(个人、组织、共享)的背景渐变替换为统一的中性纯色。
    • 移除了主容器的水平内边距。
    • 更新了分组图标的颜色,以适应新的中性色系和暗黑模式。
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/components/FileTree.tsx
    • 修改了新建文件/文件夹图标容器的背景和阴影样式,并调整了图标文本颜色。
    • 更新了新建项确认和取消按钮的背景、阴影和文本颜色,使其符合简约风格。
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/components/GroupedFileTree.tsx
    • 修改了新建项容器的背景、边框和阴影样式,移除了渐变效果。
    • 更新了新建项图标容器的背景和阴影样式,并调整了图标文本颜色。
    • 调整了新建项输入框的边框、焦点边框和焦点环颜色,并简化了阴影。
    • 更新了新建项确认和取消按钮的背景、阴影和文本颜色。
    • 修改了分组类型卡片的阴影和背景样式,并更新了图标颜色。
    • 调整了装饰性光点的颜色和不透明度。
  • apps/DocFlow/src/app/docs/_components/DocumentSidebar/folder/components/RenderFile.tsx
    • 调整了文件/文件夹项的内边距、字体大小和外边距。
    • 修改了选中项的背景、文本和边框样式,移除了蓝色高亮。
    • 更新了未选中项的悬停背景和文本颜色,移除了渐变悬停效果和缩放动画。
    • 移除了文件夹展开/折叠图标容器的右侧外边距。
    • 更新了文件夹展开/折叠按钮的悬停背景和文本颜色。
    • 移除了文件/文件夹图标容器的右侧外边距。
    • 修改了文件夹图标的背景和阴影样式,改为中性文本颜色,并增加了选中状态下的颜色。
    • 修改了文件图标的背景和阴影样式,改为中性文本颜色,并增加了选中状态下的颜色。
    • 更新了文件/文件夹名称的文本颜色,以适应选中和未选中状态下的中性色系。
    • 修改了编辑、删除、更多操作按钮的悬停样式,采用中性色调。
    • 调整了连接线的左侧定位。
    • 修改了 RenderFile 内部新建项容器的背景、边框和阴影样式。
    • 调整了 RenderFile 内部新建项图标容器的尺寸、背景和阴影样式,并更新了文本颜色。
    • 移除了 RenderFile 内部新建项输入框的垂直内边距。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 旨在优化文件树的样式,使其风格更加简约统一,这一点做得很好。通过移除渐变和阴影,视觉上确实清爽了许多。然而,在实现过程中,大量使用了硬编码的十六进制颜色值(如 #333, #e0e0e0 等),这会给未来的主题维护和样式一致性带来挑战。建议将这些颜色值抽象为 Tailwind CSS 主题配置中的语义化名称(例如,在 tailwind.config.js 中定义 theme.colors.neutral 等),然后在组件中通过 text-neutral-dark, bg-neutral-light 等方式使用。这样可以确保颜色在整个应用中的一致性,并且当需要调整色板时,只需修改一处即可。

<Icon
name={newItemType === 'folder' ? 'Folder' : 'FileText'}
className="h-3.5 w-3.5 text-white drop-shadow-sm"
className="h-3.5 w-3.5 text-[#333]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在暗黑模式下,text-[#333](深灰色)在 dark:bg-[#3a3a3a](深灰色)背景上几乎不可见,这会影响可用性。建议为暗黑模式指定一个浅色文本颜色,以确保足够的对比度。

Suggested change
className="h-3.5 w-3.5 text-[#333]"
className="h-3.5 w-3.5 text-[#333] dark:text-[#cccccc]"

'w-5 h-5 rounded-md flex items-center justify-center',
'bg-gradient-to-br from-emerald-400 to-green-500',
'shadow-md shadow-emerald-500/30',
'w-5 h-5 rounded flex items-center justify-center text-[#666666] dark:text-[#999999]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

此处的样式更改引入了一个UI问题:其子级 Icon 组件(第355行)的 className 仍为 text-white,这会导致在浅色模式下,白色图标在新的浅灰色背景(来自第341行的 bg-[#f0f0f0])上变得不可见。建议一并修改 IconclassName,移除 text-white,使其能够继承此处的文本颜色 (text-[#666666] dark:text-[#999999])。

action: () => onShare?.(file),
show: !!onShare,
className: 'text-blue-600 hover:bg-blue-50',
className: 'text-[#333] hover:bg-[#e0e0e0] dark:hover:bg-[#444444]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

使用硬编码的颜色值(如 text-[#333])会降低代码的可维护性。建议将这些颜色定义在 Tailwind 主题中,并使用语义化的类名(如 text-neutral-900)。这样可以统一管理颜色,方便未来进行主题切换或调整。此问题在此次 PR 的多个文件中都存在。

Comment on lines 38 to 49
const getGroupColor = () => {
switch (type) {
case 'personal':
return 'from-blue-500 to-indigo-600';
return 'bg-[#e0e0e0] dark:bg-[#3a3a3a]';
case 'organization':
return 'from-purple-500 to-pink-600';
return 'bg-[#e0e0e0] dark:bg-[#3a3a3a]';
case 'shared':
return 'from-green-500 to-emerald-600';
return 'bg-[#e0e0e0] dark:bg-[#3a3a3a]';
default:
return 'from-slate-500 to-slate-600';
return 'bg-[#e0e0e0] dark:bg-[#3a3a3a]';
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个 switch 语句的所有分支现在都返回相同的值。为了简化代码,可以直接移除 switch 语句,让函数直接返回该值。

  const getGroupColor = () => {
    return 'bg-[#e0e0e0] dark:bg-[#3a3a3a]';
  };

Comment on lines 223 to +227
group.type === 'shared'
? 'bg-gradient-to-br from-green-50 to-emerald-100 dark:from-green-900/20 dark:to-emerald-900/30'
? 'bg-[#f0f0f0] dark:bg-[#2a2d2e]'
: group.type === 'organization'
? 'bg-gradient-to-br from-purple-50 to-indigo-100 dark:from-purple-900/20 dark:to-indigo-900/30'
: 'bg-gradient-to-br from-blue-50 to-cyan-100 dark:from-blue-900/20 dark:to-cyan-900/30',
? 'bg-[#f0f0f0] dark:bg-[#2a2d2e]'
: 'bg-[#f0f0f0] dark:bg-[#2a2d2e]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个三元运算符的所有分支现在都返回相同的值 'bg-[#f0f0f0] dark:bg-[#2a2d2e]'。可以简化这里的逻辑,直接使用这个字符串,移除不必要的三元运算符判断。

                                'bg-[#f0f0f0] dark:bg-[#2a2d2e]',

!isSelected && [
'hover:bg-gradient-to-r hover:from-blue-50/80 hover:via-blue-100/60 hover:to-blue-50/80',
'hover:bg-[#f0f0f0] dark:hover:bg-[#2a2d2e]',
'dark:hover:from-blue-900/20 dark:hover:via-blue-800/30 dark:hover:to-blue-900/20',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这行暗黑模式下的 hover 样式似乎是旧代码的残留。它定义了一个渐变背景,与本次 PR 追求的简约风格不符,并且也与其他 hover 样式(如 hover:bg-[#f0f0f0] dark:hover:bg-[#2a2d2e])不一致。建议移除此行以保持样式统一。

@xun082 xun082 merged commit f817280 into xun082:main Mar 16, 2026
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants