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

feat(theme): adding theme support per component #500

Merged
merged 10 commits into from
Jan 11, 2023

Conversation

rluders
Copy link
Collaborator

@rluders rluders commented Dec 23, 2022

Description

Add the theme={} property to the listed components.

  • Accordion
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Breadcrumb
  • Card

Related to #465 and #443

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Breaking changes

Yes! This breaks the current theme structure. All main components now have their own styles under root object.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests

Test Configuration:

N/A

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Base: 98.96% // Head: 99.27% // Increases project coverage by +0.30% 🎉

Coverage data is based on head (321c64c) compared to base (d2206b5).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
+ Coverage   98.96%   99.27%   +0.30%     
==========================================
  Files         127      127              
  Lines        5530     5668     +138     
  Branches      466      469       +3     
==========================================
+ Hits         5473     5627     +154     
+ Misses         57       41      -16     
Impacted Files Coverage Δ
src/lib/components/Accordion/Accordion.tsx 100.00% <100.00%> (ø)
src/lib/components/Accordion/AccordionContent.tsx 100.00% <100.00%> (ø)
src/lib/components/Accordion/AccordionTitle.tsx 100.00% <100.00%> (ø)
src/lib/components/Alert/Alert.tsx 100.00% <100.00%> (ø)
src/lib/components/Avatar/Avatar.tsx 100.00% <100.00%> (+1.44%) ⬆️
src/lib/components/Avatar/AvatarGroup.tsx 100.00% <100.00%> (+31.81%) ⬆️
src/lib/components/Avatar/AvatarGroupCounter.tsx 100.00% <100.00%> (+29.16%) ⬆️
src/lib/components/Badge/Badge.tsx 100.00% <100.00%> (ø)
src/lib/components/Breadcrumb/Breadcrumb.tsx 100.00% <100.00%> (ø)
src/lib/components/Breadcrumb/BreadcrumbItem.tsx 100.00% <100.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rluders rluders merged commit 2f58ae2 into themesberg:main Jan 11, 2023
@rluders rluders deleted the feat/theme-components branch January 11, 2023 15:35
tulup-conner added a commit to tulup-conner/flowbite-react that referenced this pull request Feb 19, 2023
Follow up to themesberg#500

BREAKING CHANGE: Like in themesberg#500, this version permanently changes the `FlowbiteTheme` for numerous
components.

The philosophy is that themes will more clearly reflect the component's structure.

For example, an `<Accordion>` can contain any number of `<Accordion.Title>` or `<Accordion.Content>`
sections. The theme used to look like:

```js
accordion: {
  base: "..",
  content: "..",
  flush: "..",
  title: "..",
}
```

And now, the theme for an `<Accordion>` looks like:

```
js
accordion: {
  root: {
    base: "..",
    flush: "..",
  },
  content: "..",
  title: "..",
}
```

So now the options in the theme which apply to the `<Accordion>` itself will always be found under
`root`. Likewise, `<Accordion.Content>` can be themed via the `content` subsection.

This ultimately will apply to all components.
rluders pushed a commit that referenced this pull request Feb 20, 2023
* feat(theme): adding theme prop to components

* feat(/theme/default): finish migrating components to use a `root` theme

Follow up to #500

BREAKING CHANGE: Like in #500, this version permanently changes the `FlowbiteTheme` for numerous
components.

The philosophy is that themes will more clearly reflect the component's structure.

For example, an `<Accordion>` can contain any number of `<Accordion.Title>` or `<Accordion.Content>`
sections. The theme used to look like:

```js
accordion: {
  base: "..",
  content: "..",
  flush: "..",
  title: "..",
}
```

And now, the theme for an `<Accordion>` looks like:

```
js
accordion: {
  root: {
    base: "..",
    flush: "..",
  },
  content: "..",
  title: "..",
}
```

So now the options in the theme which apply to the `<Accordion>` itself will always be found under
`root`. Likewise, `<Accordion.Content>` can be themed via the `content` subsection.

This ultimately will apply to all components.

* ci(eslint): remove `prettier` plugins for `eslint`

Instead, use `prettier-plugin-tailwindcss`, which is sufficient.

* refactor(/lib/*): use `yarn prettier` with `prettier-plugin-tailwindcss`

* fix(/lib/components/*.spec): resolve test errors caused by migrating theme

* feat(/lib/components/*): add `theme={}` attribute to components that need it

See notes in #566

* fix(/lib/components/accordion): fix `<Accordion theme={}` types wrong interface

* docs(/pages/theme): update `/theme` documentation to include new theme strategies

We have more powerful options to customize themes now, and they deserve proper documentation.

* ci(eslint): fix `eslint` configured to ignore `src/lib/`

Well this sucks! We've not been linting the vast majority of the actual code of the library due to a
misconfigured `.eslintignore`. Mass-fix coming.

* ci(eslint): resolve outstanding `eslint` issues

* fix(/lib/components/footer/footertitle): allow `<Footer.Title as="..">` to not use `<h2>`

You can cast the component to a component of your own, or a generic HTML element, e.g.,
`<Footer.Title as="h3">`.

resolve #594

* fix(/lib/components/modal): fix `Modal` expects `document` to exist

So, I originally fixed this issue across every component in #124, but the bug was reintroduced by

resolve #609

* ci(.github/workflows/build): upgrade `codecov-action` -> `v3`

---------

Co-authored-by: Ricardo Lüders <rluders@redhat.com>
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.

1 participant