Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a new Badge component to the Flowbite component library, based on the Flowbite design system. The implementation follows established patterns in the codebase and includes comprehensive test coverage and preview examples.
Changes:
- Adds
Flowbite::Badgecomponent with support for multiple styles, sizes, borders, dots, and links - Adds
Flowbite::Badge::Pillsubclass for fully-rounded badge variants - Includes comprehensive test suite covering all component features and variants
- Provides Lookbook preview examples demonstrating all badge variants
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/components/flowbite/badge.rb | Main Badge component implementation with styles, sizes, and feature support |
| app/components/flowbite/badge/pill.rb | Pill variant subclass overriding styles for fully-rounded corners |
| app/components/flowbite/badge/badge.html.erb | ERB template rendering badge with optional dot indicator |
| test/components/flowbite/badge_test.rb | Comprehensive test suite covering all badge features and variants |
| demo/test/components/previews/badge_preview.rb | Lookbook preview examples for all badge variants |
| demo/.yardoc/* | Auto-generated YARD documentation files |
| CHANGELOG.md | Updated with Badge component addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 10 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class << self | ||
| def classes(size: :default, state: :default, style: :brand) | ||
| styles.fetch(style).fetch(state) + sizes.fetch(size) | ||
| end | ||
|
|
||
| def sizes | ||
| SIZES | ||
| end |
There was a problem hiding this comment.
The Badge class is missing a sizes class method that returns the SIZES constant, which is a pattern used in other components like Button and Input. This method provides a way to access sizes from the current class rather than a parent class. Consider adding def sizes; SIZES; end inside the class << self block for consistency with other components.
Primarily to extract the size class names
3323cba to
f0a2351
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Based on https://flowbite.com/docs/components/badge/