feat: add loading state to Button component and integrate with form submissions#20
feat: add loading state to Button component and integrate with form submissions#20
Conversation
WalkthroughThe changes introduce a new Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant P as Parent Component
participant B as Button Component
participant S as Spinner
U->>P: Submits form
P->>B: Pass isLoading value (true/false)
alt isLoading true
B->>B: Apply "cursor-progress" styling
B->>S: Render loading spinner
else isLoading false
B->>B: Render children normally
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🔇 Additional comments (11)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Visit the preview URL for this PR (updated for commit 065704b): https://remix-spa-example--pr20-feat-is-loading-xmoh8r6l.web.app (expires Sat, 15 Mar 2025 05:19:29 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 48e666b485811f0b1bcd4fa4838b32a205a3ce05 |
This pull request includes several changes to enhance the
Buttoncomponent by adding a loading state and updating its usage in different parts of the application. The most important changes include modifying theButtoncomponent to support a loading state and updating the relevant routes to utilize this new feature.Enhancements to
Buttoncomponent:app/components/ui/button.tsx: AddedSlottableimport, introducedisLoadingvariant, and updated theButtoncomponent to display a loading spinner whenisLoadingis true. [1] [2] [3]Updates to routes:
app/routes/$handle+/posts.$id.edit/route.tsx: ImporteduseNavigation, addednavigationstate, and passedisLoadingprop toButtonto show loading state during form submission. [1] [2] [3]app/routes/auth+/sign_in/route.tsx: Updated theButtonto use theisLoadingprop based onfetcher.stateto show loading state during sign-in process.Summary by CodeRabbit