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

new-log-viewer: Override JoyUI fontFamily and radius properties globally. #83

Merged
merged 3 commits into from
Oct 19, 2024

Conversation

junhaoliao
Copy link
Collaborator

@junhaoliao junhaoliao commented Sep 30, 2024

References

new-log-viewer series: #45 #46 #48 #51 #52 #53 #54 #55 #56 #59 #60 #61 #62 #63 #66 #67 #68 #69 #70 #71 #72 #73 #74 #76 #77 #78 #79 #80 #81 #82

Description

  1. Centralize border radius overrides with "radius" property in JoyUI theme config.

Validation performed

  1. Launched debug server and verified component border radius matching expected overridden value. Used the browser debugger to "Inspect" individual elements to confirm.

Summary by CodeRabbit

  • New Features

    • Introduced a new border radius property for UI components, enhancing the visual consistency across various sizes.
  • Improvements

    • Updated focus property for better accessibility, setting a more appropriate thickness.
    • Enhanced theme configuration for improved light and dark mode support, ensuring a cohesive user experience.
  • Bug Fixes

    • Removed unnecessary style overrides from specific components, streamlining their appearance.

Copy link

coderabbitai bot commented Sep 30, 2024

Walkthrough

The changes involve updates to the theme configuration in the theme.tsx file for a UI component library. The color schemes for light and dark modes remain unchanged, while the focus.default property has been removed and replaced with focus.thickness, set to "1px". A new radius property has been introduced, specifying border radius values for various sizes. Style overrides for the JoyButton, JoySelect, and JoyInput components have been removed, while the JoySelect component retains its default props. The JoyFormControl component maintains its style overrides, including hover effects for both color schemes.

Changes

Files Change Summary
new-log-viewer/src/components/theme.tsx Updated theme configuration with removed focus.default, modified focus to focus.thickness, added radius, and removed style overrides for JoyButton, JoySelect, and JoyInput.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant JoyButton
    participant JoyInput
    participant JoySelect
    participant JoyFormControl

    User->>JoyButton: Interacts (no overrides)
    User->>JoyInput: Interacts (no overrides)
    User->>JoySelect: Selects option (default props)
    User->>JoyFormControl: Interacts (with hover effects)
Loading

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.

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 (3)
new-log-viewer/src/components/theme.tsx (3)

59-63: LGTM! Consider enhancing focus styles for better accessibility.

The reintroduction of the focus property is a good step towards centralizing theme configurations. The 3px outline width provides a clear visual indicator for focused elements.

To further improve accessibility, consider adding a contrasting outline colour. For example:

 focus: {
     default: {
         outlineWidth: "3px",
+        outlineColor: "rgba(0, 0, 0, 0.5)",
+        outlineStyle: "solid",
     },
 },

This change would ensure that the focus indicator is visible against various background colours.


64-66: LGTM! Consider adding fallback fonts for improved reliability.

The reintroduction of the fontFamily property using a CSS variable is an excellent approach for centralized theme management.

To enhance reliability, consider adding fallback fonts. For example:

 fontFamily: {
-    body: "var(--ylv-ui-font-family)",
+    body: "var(--ylv-ui-font-family), -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
 },

This change ensures that if the custom font fails to load, the system will fall back to a suitable alternative.


67-75: LGTM! Consider enhancing flexibility and removing unnecessary ESLint comments.

The introduction of the radius property effectively centralizes border radius management, aligning with the PR objectives.

  1. To improve design flexibility, consider using different values for each size:
 radius: {
-    /* eslint-disable sort-keys */
-    xs: "2px",
-    sm: "2px",
-    md: "2px",
-    lg: "2px",
-    xl: "2px",
-    /* eslint-enable sort-keys */
+    xs: "2px",
+    sm: "4px",
+    md: "6px",
+    lg: "8px",
+    xl: "10px",
 },
  1. Remove the ESLint disable/enable comments as they are unnecessary when the keys are already in the desired order.

These changes would provide more design options while maintaining clean, lint-free code.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d185624 and 985a12d.

📒 Files selected for processing (1)
  • new-log-viewer/src/components/theme.tsx (1 hunks)

@Henry8192
Copy link
Collaborator

lgtm. A minor issue is outLineWidth seems to change nothing in our UI, even before the pr change.

Henry8192
Henry8192 previously approved these changes Oct 7, 2024
@kirkrodrigues kirkrodrigues changed the title new-log-viewer: Centralize border radius overrides with "radius" property in JoyUI theme config. new-log-viewer: Centralize border radius overrides with radius property in JoyUI theme config. Oct 10, 2024
@junhaoliao
Copy link
Collaborator Author

A minor issue is outLineWidth seems to change nothing in our UI, even before the pr change.

You're right. Could you check if e5186ab correctly does the override?

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: 2

🧹 Outside diff range and nitpick comments (1)
new-log-viewer/src/components/theme.tsx (1)

59-73: Overall improvements with suggestion for documentation

The changes successfully centralize border radius management and streamline the theme configuration, which aligns well with the PR objectives. The removal of component-specific overrides in favour of a global radius property should improve consistency across the UI.

However, to ensure these changes are well understood by the team:

Consider updating the project documentation to reflect these significant changes in theme configuration, especially:

  1. The new centralized radius property
  2. The changed focus thickness
  3. The removal of component-specific border radius overrides

This will help maintain clarity for future development and onboarding of new team members.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 985a12d and e5186ab.

📒 Files selected for processing (1)
  • new-log-viewer/src/components/theme.tsx (1 hunks)
🧰 Additional context used

Comment on lines +65 to +73
radius: {
/* eslint-disable sort-keys */
xs: "2px",
sm: "2px",
md: "2px",
lg: "2px",
xl: "2px",
/* eslint-enable sort-keys */
},
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider varying radius sizes and review ESLint rule usage

  1. The radius is set to "2px" for all size variants. Consider using different radii for different sizes to provide better visual distinction between components of varying sizes. For example:
radius: {
  xs: "2px",
  sm: "4px",
  md: "6px",
  lg: "8px",
  xl: "10px",
}
  1. The ESLint sort-keys rule is disabled for this section. If key sorting is generally preferred in the project, consider sorting the keys alphabetically to maintain consistency with other parts of the codebase.

Would you like assistance in implementing these suggestions?

new-log-viewer/src/components/theme.tsx Outdated Show resolved Hide resolved
@Henry8192
Copy link
Collaborator

For the title, how about: new-log-viewer: Apply ylv-font-family and override radius property globally

@junhaoliao
Copy link
Collaborator Author

For the title, how about: new-log-viewer: Apply ylv-font-family and override radius property globally

How about

new-log-viewer: Override JoyUI `fontFamily` and `radius` properties globally.

@junhaoliao junhaoliao changed the title new-log-viewer: Centralize border radius overrides with radius property in JoyUI theme config. new-log-viewer: Override JoyUI fontFamily and radius properties globally. Oct 19, 2024
Copy link
Collaborator

@Henry8192 Henry8192 left a comment

Choose a reason for hiding this comment

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

LGTM.

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