Skip to content

refactor(container): update styles and variables for container component#210

Merged
hexqi merged 3 commits intoopentiny:developfrom
gene9831:css/container
Sep 4, 2025
Merged

refactor(container): update styles and variables for container component#210
hexqi merged 3 commits intoopentiny:developfrom
gene9831:css/container

Conversation

@gene9831
Copy link
Collaborator

@gene9831 gene9831 commented Sep 4, 2025

  • Translated footer text in demo to Chinese for localization.
  • Moved CSS variable definitions for the container component to a new LESS file for better organization and maintainability.
  • Updated icon button hover background to use the new container background variable.
  • Cleaned up unused styles in the container component to streamline the codebase.

Summary by CodeRabbit

  • New Features
    • Improved container theming with fullscreen-aware tokens and reliance on global theme variables.
    • Icon Button hover now follows theme colors for consistent visuals.
  • Style
    • Replaced hard-coded background colors with theme variables; refined load order of component styles.
  • Documentation
    • Demo footer text updated and redundant background styles removed.

- Translated footer text in demo to Chinese for localization.
- Moved CSS variable definitions for the container component to a new LESS file for better organization and maintainability.
- Updated icon button hover background to use the new container background variable.
- Cleaned up unused styles in the container component to streamline the codebase.
@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

Walkthrough

Reworks container theming to emit global CSS tokens via a new Less mixin and maps those tokens to scoped CSS custom properties in the component; switches icon-button hover to a theme variable; adds container styles to component style imports; updates a docs demo's footer text and removes demo background styles.

Changes

Cohort / File(s) Summary
Container component scoped vars
packages/components/src/container/index.vue
Removes in-file Less variable generator and instead defines scoped CSS custom properties that map to global tokens; adds fullscreen fallbacks. Public API unchanged.
Container theme token generator
packages/components/src/styles/components/container.less
Adds .tr-container-vars() mixin that emits --tr-container-* variables and -fullscreen variants under :root and [data-tr-theme]; mixin is invoked to produce tokens.
Styles import ordering
packages/components/src/styles/components/index.css
Adds @import './container.less'; at top so container tokens/styles load before existing component styles (bubble, bubble-list, bubble-tool).
Icon button hover theming
packages/components/src/icon-button/index.vue
Replaces hard-coded hover background #f5f5f5 with var(--tr-container-bg-hover) to follow theme tokens.
Docs demo content & styles
docs/demos/container/basic.vue
Footer slot text changed to "这是 footer"; removed background-color rules from .content and .footer styles.
Variables comment only
packages/components/src/styles/variables.css
Inserts a comment noting a naming conflict and planned unification for container background variable; no runtime value changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop and nibble at the code,
New tokens sprout along the road.
Hover blends with themed delight,
Containers shine in softer light.
A tiny footer speaks in cheer—
I wiggle whiskers, changes near.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 69bf57a and 5a0a035.

📒 Files selected for processing (2)
  • packages/components/src/styles/components/index.css (1 hunks)
  • packages/components/src/styles/variables.css (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/components/src/styles/variables.css
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/src/styles/components/index.css
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e-tests
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
docs/demos/container/basic.vue (1)

13-13: Avoid hard-coded locale strings; use i18n token.
Use a translatable key so the demo works across locales.

Example (if vue-i18n is available):

-      <div class="footer">这是 footer</div>
+      <div class="footer">{{ $t('container.demo.footer') }}</div>
packages/components/src/styles/components/container.less (1)

11-16: Consider rem units for scalability.
Pixels are fine, but rem improves zoom/accessibility without retuning tokens.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b13a1f0 and 69bf57a.

⛔ Files ignored due to path filters (1)
  • packages/svgs/src/assets/new-session.svg is excluded by !**/*.svg
📒 Files selected for processing (5)
  • docs/demos/container/basic.vue (1 hunks)
  • packages/components/src/container/index.vue (0 hunks)
  • packages/components/src/icon-button/index.vue (1 hunks)
  • packages/components/src/styles/components/container.less (1 hunks)
  • packages/components/src/styles/components/index.css (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/components/src/container/index.vue
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-18T09:29:47.974Z
Learnt from: SonyLeo
PR: opentiny/tiny-robot#119
File: packages/components/src/attachments/index.less:213-213
Timestamp: 2025-06-18T09:29:47.974Z
Learning: 在 packages/components/src/attachments/index.less 中,.tr-file-card__close 的背景色使用了硬编码的 rgb(194, 194, 194),但这个UI元素(关闭按钮)将会被直接替换为图标,所以不需要抽取为CSS变量。

Applied to files:

  • packages/components/src/icon-button/index.vue
🪛 GitHub Actions: E2E Tests
packages/components/src/styles/components/index.css

[error] 1-1: Build failed during 'pnpm -F @opentiny/tiny-robot-* build' (vue-tsc && vite build). ENOENT: no such file or directory, open './bubble.less'. Unable to resolve @import './bubble.less' in packages/components/src/styles/components/index.css.

🔇 Additional comments (2)
packages/components/src/styles/components/container.less (1)

19-23: Confirm fullscreen typography.
title-font-size increases to 16px but title-line-height remains 22px. Verify intended rhythm; 24px is common for 16px.

packages/components/src/styles/components/index.css (1)

1-2: Check cascade/order impacts.
New imports load before prompt styles; verify no unintended precedence shifts for overlapping selectors.

@hexqi hexqi merged commit 62a0b38 into opentiny:develop Sep 4, 2025
1 check passed
@gene9831 gene9831 deleted the css/container branch September 4, 2025 09:39
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.

3 participants