Skip to content

The Spinner in Button with isProcessing prop should be colored according the Button color #1301

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

Closed
2 tasks done
MiroslavPetrik opened this issue Mar 15, 2024 · 1 comment
Closed
2 tasks done

Comments

@MiroslavPetrik
Copy link
Contributor

MiroslavPetrik commented Mar 15, 2024

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

  1. Create colored button with a spinner:
<Button color="failure" isProcessing />

Current behavior

The internal Spinner has the default color.

Expected behavior

The internal Spinner has the darker shade of the button color.

Context

The Spinner looks off, as it appears unstyled.
The original flowbite does have only the default color button in loading mode, so this is undefined, but I believe it's best to style it.

Solution

I would use the theme prop, and supply a map of darker colors, e.g. instead of the default 600 I would use 800:

const innerSpinnerTheme: FlowbiteSpinnerTheme = {
 color: {
    failure: 'fill-red-800',
    gray: 'fill-gray-800',
    info: 'fill-cyan-800',
    pink: 'fill-pink-800',
    purple: 'fill-purple-800',
    success: 'fill-green-800',
    warning: 'fill-yellow-800',
  },
}

// Button.tsx
<Spinner color={color} theme={innerSpinnerTheme} />
@MiroslavPetrik MiroslavPetrik changed the title The Spinner in Button with isProcessing prop should be collored according the Button color The Spinner in Button with isProcessing prop should be colored according the Button color Mar 15, 2024
@SutuSebastian
Copy link
Collaborator

Fixed by #1498 in [email protected] release.

Breaking changes:

  • isProcessing is no longer a business logic of Button component, please build using composition strategy rather, see Loading Buttons example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants