Click spark Updated#961
Open
R1SH4BH81 wants to merge 5 commits intomagicuidesign:mainfrom
Open
Conversation
|
@R1SH4BH81 is attempting to deploy a commit to the product-studio Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses recent code review feedback for the
click-sparkcomponent. It significantly optimizes the animation loop to prevent unnecessary CPU/battery usage, fixes registry dependency imports, and completely modernizes the component's interactive demo.Changes
requestAnimationFrameloop inclick-spark.tsxwhen there are no active sparks to save CPU and battery, automatically resuming on new clicks.click-spark-demo.tsxaesthetic. Removed the basic button and replaced it with a premium, sleek silver gradient typography (Interactive Spark) to better showcase the effect.@magicui/dot-patternfrom theregistryDependenciesinclick-spark-demo.jsonandregistry-examples.ts.click-spark.mdxto correctly point toadd @magicui/click-spark.useRefto remove unnecessary re-renders and fixuseEffectexhaustive-deps warnings.Motivation
The previous implementation kept
requestAnimationFramerunning infinitely at 60fps even when the screen was empty, causing unnecessary background processing and battery drain. The demo component was also visually basic and didn't align with the premium aesthetic of the library. Lastly, the registry dependencies and docs contained minor inaccuracies that would confuse users during installation.Breaking Changes
None. The component's props and usage remain entirely backwards compatible.
Screenshots