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

docs: update getting started guide and sandbox example for custom theme usage #944

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

cheton
Copy link
Member

@cheton cheton commented Nov 11, 2024

PR Type

documentation, enhancement


Description

  • Enhanced the theme customization by introducing a customTheme object, allowing for more flexible theme configurations.
  • Enabled CSS variables in the theme configuration, improving the styling capabilities.
  • Updated the Root component and documentation examples to utilize the new customTheme.
  • Improved documentation with examples for setting default props for specific components.

Changes walkthrough 📝

Relevant files
Enhancement
create-react-app.js
Enhance theme customization with `customTheme` object       

packages/react-docs/sandbox/create-react-app.js

  • Introduced a customTheme object to manage theme configurations.
  • Enabled CSS variables through theme configuration.
  • Updated Root component to use customTheme.
  • Added comments for setting default props for components.
  • +44/-23 
    Documentation
    index.page.mdx
    Update documentation for custom theme usage                           

    packages/react-docs/pages/getting-started/usage/index.page.mdx

  • Updated documentation to use customTheme for theme configuration.
  • Demonstrated enabling CSS variables in theme.
  • Provided examples for setting default props in components.
  • Improved code examples for clarity and accuracy.
  • +67/-24 

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    codesandbox bot commented Nov 11, 2024

    Review or Edit in CodeSandbox

    Open the branch in Web EditorVS CodeInsiders

    Open Preview

    Copy link

    changeset-bot bot commented Nov 11, 2024

    ⚠️ No Changeset found

    Latest commit: 1900ca3

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Duplication
    The customTheme object is duplicated across multiple files with identical configuration. Consider extracting it to a shared configuration file to maintain consistency and reduce duplication.

    Syntax Error
    Extra semicolon after object declaration in the customTheme configuration which could cause syntax errors

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Remove unnecessary semicolon after object definition in function component

    Remove the unnecessary semicolon after the customTheme object definition. The
    semicolon is redundant since this is inside a function component.

    packages/react-docs/sandbox/create-react-app.js [81-101]

     const customTheme = {
       ...theme,
       components: {},
       config: {
         ...theme?.config,
         useCSSVariables: true,
       },
    -};
    +}
    Suggestion importance[1-10]: 3

    Why: While technically correct, removing the semicolon is a minor style improvement that has no functional impact. The code works correctly either way, making this a low-priority suggestion.

    3

    💡 Need additional feedback ? start a PR chat

    Copy link

    This pull request is automatically built and testable in CodeSandbox.

    To see build info of the built libraries, click here or the icon next to each commit SHA.

    Copy link

    codecov bot commented Nov 11, 2024

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 78.34%. Comparing base (0ed3abc) to head (1900ca3).
    Report is 1 commits behind head on v2.

    Additional details and impacted files
    @@           Coverage Diff           @@
    ##               v2     #944   +/-   ##
    =======================================
      Coverage   78.34%   78.34%           
    =======================================
      Files         405      405           
      Lines        6640     6640           
    =======================================
      Hits         5202     5202           
      Misses       1438     1438           

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    @trendmicro-frontend-bot
    Copy link
    Contributor

    Tonic UI Demo

    On 2024-11-11 14:28:18 +0000, PR #944 (1900ca3) was successfully deployed. You can view it at the following link:
    https://trendmicro-frontend.github.io/tonic-ui-demo/react/pr-944/

    @cheton cheton merged commit 0b8452b into v2 Nov 12, 2024
    7 checks passed
    @cheton cheton deleted the docs/custom-theme branch November 12, 2024 15:23
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants