Skip to content
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

feat(card): Adapting to the SMB themes #2231

Merged
merged 1 commit into from
Oct 12, 2024
Merged

feat(card): Adapting to the SMB themes #2231

merged 1 commit into from
Oct 12, 2024

Conversation

Youyou-smiles
Copy link
Collaborator

@Youyou-smiles Youyou-smiles commented Oct 9, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Updated card component styles for enhanced visual consistency, including new variable naming conventions.
    • Improved background, border, and padding properties for various card sizes and states.
  • Bug Fixes

    • Resolved inconsistencies in card styling across different states and sizes.

These changes aim to provide a more cohesive design experience for users interacting with card components.

Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

The changes in this pull request involve a comprehensive update to the card component's styling in the index.less and vars.less files. The updates primarily focus on renaming CSS variables from the prefix --ti- to --tv-, affecting various properties such as background colors, border colors, widths, border radii, and padding values. The modifications ensure consistency across different card sizes and states, including adjustments to hover effects and footer styles.

Changes

File Path Change Summary
packages/theme/src/card/index.less Updated CSS variable references for card component styling.
packages/theme/src/card/vars.less Renamed multiple CSS variables from --ti- to --tv- for various properties related to card styling.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • zzcr

🐇 In the land of code where styles align,
The cards now shine with a new design.
From --ti- to --tv-, a change so neat,
With colors and borders, they’re now complete!
Hopping through variables, a joyful spree,
Our card component dances, wild and free! 🌟


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?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

@github-actions github-actions bot added the enhancement New feature or request label Oct 9, 2024
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: 0

🧹 Outside diff range and nitpick comments (5)
packages/theme/src/card/vars.less (3)

36-48: Improved state-based styling with design system integration.

The border color variables for different card states have been updated to follow the new naming convention and now reference base color variables from the design system. This change improves consistency and makes it easier to maintain a cohesive look across components.

However, there's an opportunity for further improvement:

  1. The alerting state color (#fac20a) is hardcoded. Consider using a variable for consistency, e.g., var(--tv-color-act-alerting-border).
  2. The default border color is set to #ffffff (white). Ensure this is intentional, as it might not be visible on white backgrounds.

51-57: Updated body padding variables with partial design system integration.

The body padding variables for all card sizes have been updated to follow the new naming convention. The use of space variables for small and mini sizes improves consistency with the design system.

Suggestion for improvement:
Consider using space variables for large and medium sizes as well, to maintain consistency across all size variants and to better integrate with the design system. For example:

--tv-Card-large-body-padding: var(--tv-space-3xl, 32px);
--tv-Card-medium-body-padding: var(--tv-space-2xl, 24px);

This change would make it easier to maintain and adjust padding values globally.


Line range hint 1-81: Overall improvement in design system integration with minor suggestions for further enhancement.

The changes to the card component variables demonstrate a significant improvement in aligning with the design system. The consistent naming convention and extensive use of design system variables enhance maintainability and ensure visual coherence across the application.

Summary of improvements:

  1. Consistent naming convention (--tv-Card-*) across all variables.
  2. Extensive use of design system variables for colors, typography, spacing, and sizing.
  3. Improved flexibility for future design system updates.

Suggestions for further enhancement:

  1. Replace the hardcoded alerting color (#fac20a) with a design system variable.
  2. Consider using spacing variables for large and medium card body padding.
  3. Review the default border color (white) to ensure it's intentional and visible on all backgrounds.

These minor adjustments would further improve the consistency and maintainability of the card component within the design system.

packages/theme/src/card/index.less (2)

29-29: Consider maintaining hover effect for better UX

Removing the box-shadow on hover eliminates visual feedback for user interaction. This might negatively impact user experience. Consider maintaining some form of hover effect, even if it's subtle, to indicate interactivity.


153-154: Consider using variables for image border radius

The border radius for the top corners of images has been set to explicit pixel values. Consider using variables for consistency with the rest of the component, especially if these should match the card's border radius.

Suggestion:

- border-top-left-radius: 8px;
- border-top-right-radius: 8px;
+ border-top-left-radius: var(--tv-Card-image-border-radius, 8px);
+ border-top-right-radius: var(--tv-Card-image-border-radius, 8px);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 69b6208 and 7eefb8b.

📒 Files selected for processing (2)
  • packages/theme/src/card/index.less (10 hunks)
  • packages/theme/src/card/vars.less (1 hunks)
🧰 Additional context used
🔇 Additional comments (16)
packages/theme/src/card/vars.less (5)

15-15: Improved naming convention and value consistency.

The variable has been renamed from --ti-card-bg-color to --tv-Card-bg-color, adopting a more consistent naming convention with PascalCase for the component name. The value now references a base variable --tv-color-bg-secondary, which improves consistency across the design system.


18-24: Consistent naming and flexible sizing for card widths.

The width variables for all card sizes (large, medium, small, mini) have been updated with the new naming convention. The use of var(--tv-size-base, 4px) as a base unit provides flexibility for future adjustments to the design system. This change improves consistency and maintainability.


27-33: Consistent border radius variables aligned with design system.

The border radius variables for all card sizes have been updated to follow the new naming convention. The values now reference base border radius variables, which enhances consistency with the overall design system and allows for easier global updates.


60-68: Improved typography consistency with design system integration.

The typography variables for the card component have been updated to follow the new naming convention and now reference design system variables for font sizes, colors, and weights. This change significantly improves consistency with the overall design system and makes it easier to maintain a cohesive typographic style across components.

The use of variables like var(--tv-font-size-lg) and var(--tv-color-act-primary-text) ensures that any global changes to the design system will be automatically reflected in the card component, improving maintainability.


71-81: Enhanced consistency in option and footer styling with design system integration.

The variables for card options, disabled state, footer, and title margin have been updated to follow the new naming convention and now reference design system variables. This change improves consistency with the overall design system and enhances maintainability.

Key improvements:

  1. Use of semantic color variables (e.g., var(--tv-color-bg-primary) for option text color)
  2. Consistent font size references (e.g., var(--tv-font-size-lg))
  3. Adoption of spacing variables (e.g., var(--tv-space-xl) for title margin)

These changes ensure that the card component will automatically reflect any global design system updates, maintaining visual consistency across the application.

packages/theme/src/card/index.less (11)

34-46: LGTM: Consistent variable updates for border radius

The updates to the border radius variables for different card sizes are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


50-62: LGTM: Consistent variable updates for card widths

The updates to the width variables for different card sizes are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


67-83: LGTM: Consistent variable updates for card states

The updates to the border color variables for different card states (success, warning, alerting, danger, default) are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design and functionality.


131-131: LGTM: Consistent variable update for disabled state

The update to the background color variable for the disabled state is consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


169-181: LGTM: Consistent variable updates for card padding

The updates to the padding variables for different card sizes are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


212-222: LGTM: Consistent variable updates for typography

The updates to the typography-related variables (font size, weight, margin, and color) for title and main text are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


249-254: LGTM: Consistent variable updates for footer options

The updates to the variables for footer options (border color, text color, and font size) are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design.


Line range hint 268-288: LGTM: Consistent variable updates for various states

The updates to the color variables for disabled icon, footer more text, and disabled dropdown item are consistent with the new naming convention. The logic remains unchanged, which is good for maintaining the existing design and functionality.


Line range hint 1-301: Summary of Card Component Styling Changes

The changes in this file primarily involve updating CSS variable names from --ti- to --tv-, which appears to be part of a larger effort to standardize naming conventions. Most changes are straightforward and maintain the existing design logic. However, a few points require attention:

  1. The change to min-width: auto might affect layout behavior.
  2. Removal of the hover effect's box-shadow could impact user experience.
  3. Changing the display property to flex for checkbox-checked items might affect their layout.
  4. Explicit border radius values for images could be replaced with variables for consistency.

Please address these points and ensure thorough testing across different viewport sizes and states to maintain the component's integrity and user experience.

To ensure consistency across the entire component, consider running:

#!/bin/bash
# Check for any remaining --ti- prefixed variables that might have been missed
rg --type less "--ti-" packages/theme/src/card/

Line range hint 88-114: Verify the impact of changing display to flex for checked items

While the border color update is consistent with the new naming convention, changing the display property to flex for checkbox-checked items might affect their layout. Please ensure this change doesn't cause unexpected layout shifts or alignment issues.

Consider running the following test:

✅ Verification successful

Display property change verified. No layout issues detected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any existing flex layouts or related styles that might interact with this change
rg --type less "(display:\s*flex|align-items|justify-content)" packages/theme/src/card/

Length of output: 647


Script:

#!/bin/bash
# Search for any existing flex layouts or related styles that might interact with this change
rg --type less "(display:\s*flex|align-items|justify-content)" packages/theme/src/card/

Length of output: 771


22-26: Verify the impact of min-width: auto

The change from a specific min-width value to auto might affect the card's layout behavior, especially in responsive designs. Please ensure this change doesn't cause unexpected layout shifts or breakages across different viewport sizes.

Consider running the following test:

✅ Verification successful

Further investigate usage of min-width: auto within media queries

Please run the following script to identify if min-width: auto is used within any media queries, which could impact responsive design behaviors:


Correct the search command for min-width: auto within media queries

The previous script encountered a syntax error. Please run the corrected script below to search for min-width: auto within .less files in packages/theme/src/:


Run the corrected script to search for min-width: auto within media queries

Please execute the following script to accurately identify any instances of min-width: auto within media queries in .less files:


Run the corrected script to search for min-width: auto within Less files

Please execute the following script to accurately identify any instances of min-width: auto within .less files in packages/theme/src/:


min-width updated to auto does not impact media queries

The change to min-width: auto has been applied consistently across the following files:

  • packages/theme/src/card/index.less
  • packages/theme/src/transfer/index.less
  • packages/theme/src/query-builder/index.less
  • packages/theme/src/grid-toolbar/index.less
  • packages/theme/src/badge/index.less

This update does not affect any media queries or responsive design breakpoints.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any responsive design breakpoints or media queries that might be affected
rg --type less "(@media|@custom-media)" packages/theme/src/

Length of output: 4929


Script:

#!/bin/bash
# Search for 'min-width: auto' within media queries in Less files
rg --type less '@media' -A5 'min-width:\s*auto' packages/theme/src/

Length of output: 20273


Script:

#!/bin/bash
# Search for 'min-width: auto' within media queries in Less files
rg --type less '@media' packages/theme/src/ | rg 'min-width:\s*auto'

Length of output: 68


Script:

#!/bin/bash
# Search for 'min-width: auto' within media queries in Less files
rg --type less '@media' packages/theme/src/ | rg 'min-width:\s*auto'

Length of output: 68


Script:

#!/bin/bash
# Search for 'min-width: auto' in Less files within the specified directory
rg --type less 'min-width:\s*auto' packages/theme/src/

Length of output: 366

@Youyou-smiles Youyou-smiles changed the title feat(card): [card] Adapting to the SMB themes feat(card): Adapting to the SMB themes Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

@@ -12,76 +12,71 @@

.component-css-vars-amount() {
Copy link
Member

Choose a reason for hiding this comment

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

component-css-vars-amount 改成 inject-Card-vars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants