[2.x] feat: create reusable Hero component#4215
Merged
imorland merged 11 commits intoflarum:2.xfrom Mar 7, 2026
Merged
Conversation
Hero componentHero component
Hero componentHero component
Hero componentHero component
Contributor
Author
|
FYI @imorland I just made a minor change I've had in mind. This PR is now good to go from my side |
imorland
requested changes
Feb 21, 2026
Member
imorland
left a comment
There was a problem hiding this comment.
Thanks for this — the design is solid and consistent with the existing Modal pattern. This PR has been open for a while but I checked: the Laravel upgrade, LESS 5.x upgrade, and webpack changes that landed since opening do not affect any of this, so it is not stale. A few things to address before merge.
Summary of required changes:
- Add
import './components/Hero'toforum.ts— explicit registration is the established convention and important for discoverability as a first-class extension point - Add JSDoc to
viewItems()— it is the primary structural extension point but has no documentation - Remove
?? undefinedfromstyle={}inHero.view()— redundant sincestyle()already returnsundefined, notnull - Fix
Hero.view()return type fromMithril.Vnode | nulltoJSX.Element— the base never returnsnull - Document the
viewItems()→bodyItems()rename as a breaking change in the PR description and upgrade guide - Add a note about
UserPage'sUserHero(viaUserCard) being intentionally excluded
Also worth considering:
- The
TagHero.className()approach of returning a space-separated string passed toclassList()works with clsx 1.x but would silently break on a future upgrade to clsx 2.x, which does not split strings. See inline comment. - Tests: the checklist item is unchecked. Snapshot/render tests confirming HTML structure is preserved would be valuable given the inheritance chain changes.
imorland
approved these changes
Mar 7, 2026
Hero componentHero component
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.
Fixes #4202
Changes proposed in this pull request:
Reviewers should focus on:
Screenshot
DOM / UI should stay the same
Necessity
Confirmed
composer test).Required changes: