Skip to content

[SDK] ensure that the default spinner stroke color gets inherited from the parentnode #7157

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

Conversation

RobbyUitbeijerse
Copy link
Contributor

@RobbyUitbeijerse RobbyUitbeijerse commented May 26, 2025

In a few cases the got an explicit color passed, eg accentButtonText, but this isn't great if the element in which is rendered has a variant or style prop that affects the color property of said element, as the Spinner will simply keep rendering in the color you passed it, unless you also dynamically switch the color property of the Spinner in similar fashion to the parent.

In the case of the FiatScreenContent and SwapScreenContent, the Button component that's rendered switches between the 'accent' and 'outline' variant when the buttons are disabled, which causes the Spinner to render the 'accentButtonText' color even though the 'outline' variant of the Button was active.

I considered two ways of fixing this

1 Removing the variant switching
2 Simply allowing the Spinner to inherit the color of the parent node

The latter seemed like the most flexible solution. The current color property on the Spinner is required so there's no risk in breaking any existing instance of the Spinner component, and it allows for simpler usage without explicit color passing.

Let me know if you prefer option 1 here, or whenever you see a different solution, happy to adjust where needed.


PR-Codex overview

This PR focuses on updating the Spinner component by making the color prop optional and setting its default stroke color to currentColor. This change simplifies the usage of the Spinner in different contexts, particularly in the FiatScreenContent and SwapScreenContent components.

Detailed summary

  • Updated the Spinner component to make the color prop optional.
  • Set the default stroke color of the Spinner to currentColor.
  • Removed the color prop from Spinner instances in FiatScreenContent.tsx and SwapScreenContent.tsx.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Style
    • Updated spinner appearance in wallet screens by removing explicit color styling, enabling it to inherit default or theme-based colors.
  • Refactor
    • Enhanced spinner component flexibility by making the color optional and defaulting to the current text color when unspecified.

@RobbyUitbeijerse RobbyUitbeijerse requested review from a team as code owners May 26, 2025 08:22
Copy link

changeset-bot bot commented May 26, 2025

🦋 Changeset detected

Latest commit: be0f973

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

graphite-app bot commented May 26, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels May 26, 2025
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

This change makes the color prop of the Spinner component optional, defaulting to "currentColor" if not specified. Correspondingly, usages of Spinner in fiat and swap screen content components are updated to omit the explicit color prop, relying on the new default behavior. No control flow or exported entity logic is altered.

Changes

Files Change Summary
.../ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx
.../Buy/swap/SwapScreenContent.tsx
Removed the color="accentButtonText" prop from <Spinner>, now only passing size="sm".
.../ui/components/Spinner.tsx Made color prop optional; defaults to "currentColor" if not provided; updated type and rendering logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Button
    participant Spinner

    User->>Button: Initiate loading state (e.g., get price quote)
    Button->>Spinner: Render Spinner (size="sm", color optional)
    Spinner->>Button: Display spinner (uses provided color or defaults)
    Button->>User: Shows loading spinner with correct color
Loading

Possibly related PRs

Suggested reviewers

  • joaquim-verges

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5c0ad6 and be0f973.

📒 Files selected for processing (1)
  • .changeset/fast-onions-obey.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fast-onions-obey.md

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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

vercel bot commented May 26, 2025

@RobbyUitbeijerse is attempting to deploy a commit to the thirdweb Team on Vercel.

A member of the Team first needs to authorize it.

@RobbyUitbeijerse RobbyUitbeijerse changed the title fix: ensure that the default spinner stroke color gets inherited from the parentnode [SDK] ensure that the default spinner stroke color gets inherited from the parentnode May 26, 2025
Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

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

can you add a lil changeset?

pnpm changeset from the root of the repo, press enter until you get to enter the msg

@RobbyUitbeijerse
Copy link
Contributor Author

can you add a lil changeset?

pnpm changeset from the root of the repo, press enter until you get to enter the msg

Done! Will include that in every future PR.

@joaquim-verges joaquim-verges merged commit 52d451f into thirdweb-dev:main May 27, 2025
5 of 10 checks passed
@joaquim-verges joaquim-verges mentioned this pull request May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants