-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 修复暗黑模式下评论框输入显示问题 #29
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes involve updates to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for visionary-sunflower-dc7ae3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
.vitepress/theme/components/Comments.vue (2)
37-42
: Improved visibility of comment input in dark mode, but consider using CSS variables for better theme support.The addition of this style rule addresses the visibility issue in dark mode by setting a specific color for the textarea. This is a good start, but we can make it more robust:
- The use of
:deep
is correct and follows modern Vue 3 / Vite practices.- However, setting a fixed color might not be ideal for all themes or if the site supports both light and dark modes.
Consider using CSS variables for better theme support. Here's an example of how you could modify this:
<style scoped> /* Use :deep(<inner-selector>) instead of ::v-deep <inner-selector>. */ #gitalk-container :deep(.gt-header-textarea) { - color: #2c3e50; + color: var(--vp-c-text-1); } </style>This assumes that your VitePress theme defines
--vp-c-text-1
as an appropriate text color for both light and dark modes. If it doesn't, you might need to define your own CSS variables in your theme's root styles.
23-23
: PR objectives addressed, but consider a more robust solutionThe changes in this PR successfully address the visibility issue of the comment input field in dark mode, which was the main objective. The added style rule ensures that the text is visible by setting a specific color.
However, while this solves the immediate problem, it might not be the most robust solution for a theme-aware application. As suggested in the previous comment, using CSS variables would provide better support for different themes and modes.
To further improve this solution:
- Implement CSS variables for text colors in your theme.
- Use these variables in the Comments component to ensure consistency across different modes.
- Test the visibility in both light and dark modes to ensure optimal contrast and readability.
This approach will make your component more maintainable and adaptable to future theme changes.
Also applies to: 37-42
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
bun.lockb
is excluded by!**/bun.lockb
📒 Files selected for processing (1)
- .vitepress/theme/components/Comments.vue (2 hunks)
🔇 Additional comments (1)
.vitepress/theme/components/Comments.vue (1)
23-23
: Improved type safety fordeleteChild
function call.The change to cast
element
asHTMLDivElement
enhances type safety in TypeScript. This ensures that theelement
passed todeleteChild
is of the expected type, reducing the potential for runtime errors.
原来的暗黑模式评论区输入完全看不见, 稍微修改了一点样式. 我修改了主题源码但是没有生效(doge太菜了)
原来的:
修改后:
Summary by CodeRabbit
New Features
Bug Fixes