nextui icon indicating copy to clipboard operation
nextui copied to clipboard

docs(themes): add theme generator

Open xylish7 opened this issue 1 year ago • 9 comments

Closes #3066

📝 Description

This PR introduces a theme generator to the NextUI documentation. The theme generator is accessible via a new navigation item, Themes, making it easier for users to create and customize themes.

image

⛳️ Current Behavior

Currently, the NextUI documentation does not include a theme generator, limiting users' ability to easily create and preview custom themes.

🚀 New Behavior

With this PR, a theme generator will be added to the NextUI documentation, allowing users to generate and customize themes directly within the platform.

💣 Breaking Change

No, this PR does not introduce any breaking changes.

📝 Additional Information

There is an issue with the default color in the white theme; it does not perfectly match the tints and shades of the zinc color used by NextUI's default palette. Although a suitable solution hasn't been found yet, this should not be a blocker, as users can manually adjust the colors. Efforts to resolve this issue will continue.

This version is more concise and polished, improving clarity and flow while retaining all important details.

Summary by CodeRabbit

  • New Features

    • Added a NavbarItem for direct navigation to the themes section.
    • Introduced a FontSizes component for configuring font size settings.
    • Added FontSizeInput components for various font size categories.
    • Launched a FontSizeShowcase component to display text elements with different font sizes.
    • Introduced a CircularProgress component to showcase variations of circular progress indicators.
    • Added a ThemeBuilder component to manage theme configurations and loading states.
  • Bug Fixes

    • Resolved issues related to state management and color updates in theme components.
  • Documentation

    • Updated documentation to reflect new components and usage instructions.
  • Chores

    • Added new dependencies for color management and UI enhancements.

xylish7 avatar Sep 03 '24 15:09 xylish7

⚠️ No Changeset found

Latest commit: a46195435a91c1f8a1638fb5daf94237d6b0be71

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

changeset-bot[bot] avatar Sep 03 '24 15:09 changeset-bot[bot]

@xylish7 is attempting to deploy a commit to the NextUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Sep 03 '24 15:09 vercel[bot]

Walkthrough

The changes introduce a new navigation item in the Navbar component for accessing the "/themes" route, enhancing user navigation. Additionally, two new dependencies, react-colorful and values.js, are added to the project's package.json file. These updates primarily focus on improving the navigation experience without altering the existing logic or structure of the application significantly.

Changes

File Path Change Summary
apps/docs/components/navbar.tsx Added NavbarItem for navigation to the "/themes" route.
apps/docs/package.json Added dependencies: react-colorful and values.js.

Assessment against linked issues

Objective Addressed Explanation
Theme generator implementation (3066)
Documentation mention for theme builder No documentation updates were included in the changes.
User interface for theme customization It is unclear if the new link will be documented or integrated into the theme generator.

Possibly related PRs

  • #3737: This PR modifies the Navbar component in the same navbar.tsx file, indicating a direct connection in terms of changes made to the navigation structure.
  • #3815: This PR updates the Navbar component to replace the TwitterIcon with XIcon, reflecting modifications to the navigation links, similar to the addition of the "Themes" link in the main PR.

Suggested labels

📋 Scope : Docs

Suggested reviewers

  • wingkwong
  • jrgarciadev

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.

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.

coderabbitai[bot] avatar Sep 03 '24 15:09 coderabbitai[bot]

@wingkwong I fixed the ts error and also implemented the feedback from coderabbitai, but the new reviews from coderabbit ai feels a little bit overkill and don't think they improve the quality of code. I don't find that level of abstraction needed for this simple case.

Let me know if there is anything else I need to handle.

xylish7 avatar Sep 30 '24 16:09 xylish7

Thanks. We'll review gradually.

wingkwong avatar Sep 30 '24 16:09 wingkwong

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-docs-v2 ❌ Failed (Inspect) Oct 13, 2024 7:31am
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 7:31am

vercel[bot] avatar Oct 13 '24 06:10 vercel[bot]

Hmm...it's weird why it's complaining about brand color not being defined since...since the types seems to be correct. Will look into it.

xylish7 avatar Oct 13 '24 10:10 xylish7

I'm unable to see why there is a issue with that.

The Config interface looks like this

export interface Config {
  light: ConfigColors;
  dark: ConfigColors;
  layout: ConfigLayout;
}

The ThemeType type loooks like this:

export type ThemeType = "light" | "dark";

And the issue is mentioned in brand-colors.tsx, where it says that config[theme] is undefined, which, based on the types definition of Config and ThemeType it can't be true.

image

Can it be a Typescript compiler issue or I'm missing something?

xylish7 avatar Oct 15 '24 09:10 xylish7

So the problem was related to SSR. The theme builder was rendered on server side and because of this some values were initialized with false. I've added a check to render the theme builder only on client side and while the js is loading, a loader is displayed.

image

The build succeeded. Let me know if there is anything else I need to fix. Thank you!

xylish7 avatar Oct 18 '24 18:10 xylish7

Hey @xylish7 thanks for this great contribution 🙏🏻 could you please fix the conflicts?

jrgarciadev avatar Nov 04 '24 21:11 jrgarciadev

Sure! Will look into it today 👍🏻

xylish7 avatar Nov 06 '24 07:11 xylish7

@jrgarciadev I've fixed the merge conflicts. Only pnpm-lock.yaml was conflicting.

I also run the build and test command which successfully ran, but there was an error related to the usage of new Image which I haven't touched, so not sure if that was already present or it was because I regenerated the pnpm-lock.yaml file

xylish7 avatar Nov 06 '24 18:11 xylish7

handled in #4626

macci001 avatar Jan 23 '25 18:01 macci001

Thanks @xylish7 for the amazing work. I have created a new PR to handle this further.

macci001 avatar Jan 23 '25 18:01 macci001

Thanks for your further contributions and improvements. Can't wait to see it in prod!

xylish7 avatar Feb 06 '25 06:02 xylish7