Skip to content

Introduce Flowbite::Styles#52

Merged
koppen merged 3 commits intomainfrom
styles
Dec 1, 2025
Merged

Introduce Flowbite::Styles#52
koppen merged 3 commits intomainfrom
styles

Conversation

@koppen
Copy link
Copy Markdown
Member

@koppen koppen commented Dec 1, 2025

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new Flowbite::Styles class to provide better error messages when an unknown style is requested. The class acts as a wrapper around a hash of styles, delegating to Flowbite::Style instances internally and providing helpful error messages that list available styles when a requested style is not found.

  • Introduces Flowbite::Styles class with from_hash factory method and custom StyleNotFoundError
  • Updates all component styles methods to use Flowbite::Styles.from_hash instead of plain hashes
  • Changes style definitions from Flowbite::Style.new instances to plain hashes that are wrapped by from_hash

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/components/flowbite/styles.rb New class providing improved error handling for style lookups with helpful error messages
app/components/flowbite/input/validation_error.rb Updated to use Flowbite::Styles.from_hash (inconsistent - still uses Style.new)
app/components/flowbite/input/textarea.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/radio_button.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/label.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/hint.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/file.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/field.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/input/checkbox.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/card.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/button/pill.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/button/outline.rb Converted style definitions to plain hashes for use with Styles.from_hash
app/components/flowbite/button.rb Converted style definitions to plain hashes for use with Styles.from_hash
CHANGELOG.md Documents the improved error message feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This gives us a bit more control and allows us better error messages.
Since we've already confirmed the key exists with we can safely use
`@styles[style_name]` instead of `@styles.fetch(style_name)` for direct
hash access.
@koppen koppen merged commit 68a4d2e into main Dec 1, 2025
5 checks passed
@koppen koppen deleted the styles branch December 1, 2025 15:30
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.

2 participants