Skip to content
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

feature(component): Rewrite Alerts to use themes, resolves #126 #151

Merged
merged 8 commits into from
May 22, 2022

Conversation

@tulup-conner tulup-conner changed the title refactor(component): Rewrite Alerts to use themes feature(component): Rewrite Alerts to use themes May 21, 2022
@tulup-conner tulup-conner marked this pull request as ready for review May 21, 2022 00:14
@tulup-conner
Copy link
Collaborator Author

I was able to test this with the following code in my own app:

<Alert color="primary">Test</Alert>

It works great 💯

Copy link
Collaborator

@rluders rluders left a comment

Choose a reason for hiding this comment

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

Looks great, just a few comments.

@tulup-conner tulup-conner requested a review from rluders May 21, 2022 09:18
@tulup-conner
Copy link
Collaborator Author

@rluders Using DeepPartial you can get full type checking on your custom theme:

const theme: DeepPartial<FlowbiteTheme> = {
    alert: {
      color: {
        primary: "bg-primary",
        // Now provides suggestions while typing in VS Code
      },
    },
  };

  return (
    <Flowbite theme={{ theme }}>
      <Outlet />
    </Flowbite>
  );

@tulup-conner tulup-conner changed the title feature(component): Rewrite Alerts to use themes feature(component): Rewrite Alerts to use themes, resolves #126 May 22, 2022
Create a strict type for `FlowbiteTheme`.
We can use a modified version of `Partial` that
deeply searches objects for partials. This lets you
include any of the values in `FlowbiteTheme`,
without needing to include all of them.
Replaces generic color names by semantic names:

- `green` -> `success`
- `yellow` -> `warning`
- `red` -> `failure`
- `info` -> `blue`

This naming scheme makes it more immediately
obvious which color to choose in many situations.
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

Successfully merging this pull request may close these issues.

None yet

2 participants