✨ Add ImpersonateBanner navigation component#24
Conversation
Closes #16. A fixed-top warning banner that signals the current user is impersonating someone, with a clear exit link. Ships the CSS trick that adjusts a Bootstrap fixed-top navbar to sit 28 px below the banner and bumps --app-navbar-offset to 108 px via body:has(). Pairs with the upcoming Enabel:Ux:ImpersonateDropdown (#15).
|
Smoke-tested in Impala — rendered four variants including the navbar cooperation test the PR explicitly asks for. What I verified
Note for Impala (not a PR comment) Impala already carries the same CSS rules in One small docs idea (optional) The "CSS shipping" section mentions duplicate LGTM, ready to tag. |
|
Doc updated in efca92b — added an "Adopting the component when you already have impersonate-banner CSS" section explaining that the inline |
Summary
ImpersonateBannernavigation component, a 28 px fixed-top warning band shown when a user is impersonating someone via Symfony'sIS_IMPERSONATORfeature..impersonate-banner ~ .navbar.fixed-top { top: 28px; }andbody:has(.impersonate-banner) { --app-navbar-offset: 108px; }. Without these, the navbar ends up either crammed under the banner or leaves a 28 px gap.{% if is_granted('IS_IMPERSONATOR') %}— when there's no impersonation, no banner is rendered and the layout offset stays at its default.ux_icon()(defaultfa6-solid:user-secret), andmessagethrough|rawso the call site can wrap the impersonated username in<strong>.API
messagestringexitUrlstringexitLabelstring'Exit impersonation'iconstring'fa6-solid:user-secret'CSS shipping
The component inlines the ~15 lines of CSS inside a
<style>tag in the template — same pattern as the markup, no additionalimportmap:requirestep for the consumer. If the banner ever ends up rendered twice on the same page (improbable), the duplicate<style>is harmless.Pairs with
Test plan
--app-navbar-offsetvariable cooperate with the project layoutCloses #16.