Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a default Flowbite-based Sidebar component (plus navigation + item subcomponents) and wires it into the demo docs UI to replace hand-written sidebar markup.
Changes:
- Introduces
Flowbite::Sidebar,Flowbite::Sidebar::Navigation, andFlowbite::Sidebar::ItemViewComponents. - Adds component tests and a Lookbook preview for the new sidebar pieces.
- Updates demo docs pages/components templates to render sidebar navigation via the new components (and updates demo dependencies / generated docs artifacts).
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/components/flowbite/sidebar.rb | New fixed-position sidebar container component with default classes/options. |
| app/components/flowbite/sidebar/navigation.rb | New <ul> navigation component with renders_many :items. |
| app/components/flowbite/sidebar/item.rb | New navigation item component rendering <li><a>…</a></li> with optional icon slot. |
| test/components/flowbite/sidebar_test.rb | Adds Minitest coverage for Sidebar, Navigation, and Item behavior/markup. |
| demo/test/components/previews/sidebar_preview.rb | Adds a Lookbook preview showcasing the sidebar + several items/icons. |
| demo/app/views/docs/pages/show.html.erb | Replaces hardcoded docs sidebar list with Sidebar Navigation/Item components. |
| demo/app/views/docs/components/show.html.erb | Same as above for components docs page. |
| demo/Gemfile.lock | Bumps local gem version and updates demo dependencies (including view_component). |
| demo/.yardoc/objects/root.dat | New YARD-generated artifact added to demo directory. |
| demo/.yardoc/object_types | New YARD-generated artifact added to demo directory. |
| demo/.yardoc/checksums | New YARD-generated metadata added to demo directory. |
Comments suppressed due to low confidence (4)
demo/test/components/previews/sidebar_preview.rb:63
- This preview renders nested components via
ApplicationController.render(and duplicates it inrender_item/render_to_string). Other Lookbook previews in this repo render nested components directly withrender(...)blocks; switching to that pattern would reduce complexity and avoid controller-level rendering in the preview.
def render_item(component)
ApplicationController.render(component, layout: false)
end
def render_to_string(component)
app/components/flowbite/sidebar.rb:37
- The YARD type annotation for
class:is listed as[Array<String>], but this component accepts aStringas well (tests pass a string andArray.wrapis used). Consider changing the doc type to[String, Array<String>]to match actual usage.
# @param class [Array<String>] Additional CSS classes for the sidebar
# container.
# @param options [Hash] Additional HTML options for the sidebar container.
def initialize(class: nil, **options)
super()
@class = Array.wrap(binding.local_variable_get(:class))
@options = options
app/components/flowbite/sidebar/navigation.rb:40
- The YARD type annotation for
class:is listed as[Array<String>], butArray.wrapallows callers to pass aStringtoo. Consider updating the doc type to[String, Array<String>]to reflect supported inputs.
# @param class [Array<String>] Additional CSS classes for the list element.
# @param options [Hash] Additional HTML options for the list element.
def initialize(class: nil, **options)
super()
@class = Array.wrap(binding.local_variable_get(:class))
@options = options
app/components/flowbite/sidebar/item.rb:43
- The YARD type annotation for
class:is listed as[Array<String>], but this component accepts aStringas well (it usesArray.wrap). Consider updating the doc type to[String, Array<String>]to match actual usage.
# @param class [Array<String>] Additional CSS classes for the link element.
# @param href [String] The URL for the navigation link.
# @param options [Hash] Additional HTML attributes for the link element.
def initialize(href:, class: nil, **options)
super()
@class = Array.wrap(binding.local_variable_get(:class))
@href = href
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This allows us to render the navigation items in the sidebar without needing to render the entire sidebar component, which is useful for cases like the documentation sidebar where we want to reuse the navigation structure but not the fixed positioning or background styles of the full sidebar.
c6dd030 to
94cf21d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Default sidebar component based on https://flowbite.com/docs/components/sidebar/