Repository navigation
Extract sidebar footer into a shadowable component - #18
Merged
Merged
Conversation
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.
Summary
BridgetownStoa::SidebarFooter, rendered bybridgetown-stoa/layoutin place of the inline markup. Markup is unchanged.BridgetownStoa::Shadowable, a small mixin that makes a gem component look for its template in the host site'ssrc/_componentsdirectory before falling back to the gem's copy. Bridgetown resolves a component's template next to the file that defines its Ruby class, which for a gem component is always inside the gem, so without this a host.serbwould be silently ignored. (Serbea partials don't help either: they only resolve from the host's_partialsdir.)SidebarandSidebarFooterextend the mixin, sosrc/_components/bridgetown_stoa/sidebar.serband.../sidebar_footer.serbnow shadow the respective templates. Only the template is replaced; the Ruby class still comes from the gem.Motivation
Guided-Rails/a11y-lint#115 copies Stoa's entire layout into the docs site just to add a "A Guided Rails project" line to the footer, and its header comment asks for a footer override point. After this ships, that copy can be replaced with a single
sidebar_footer.serb.Test plan
script/cibuild— rubocop clean, 15 tests / 52 assertions passtest/test_sidebar_footer.rbcovers the default footer rendering inside<aside>and a host-site template shadowing it (writes and removes a fixture_componentsdir within the test)bin/dev(fast refresh matches on the resolved template path and reloads the component class, but I haven't watched it happen)🤖 Generated with Claude Code