Merge pull request #275 from element-hq/t3chguy/banner-title

Allow the banner title to differ from `brand`
This commit is contained in:
Michael Telatynski
2026-05-28 17:18:41 +01:00
committed by GitHub
4 changed files with 17 additions and 7 deletions
+6 -5
View File
@@ -5,11 +5,12 @@ Allows rendering a top bar with slide out left panel menu.
Supports the following configuration options: Supports the following configuration options:
| Key | Type | Description | | Key | Type | Description |
| ------------- | ------ | ------------------------------------------------------------ | | ------------- | ------ | ---------------------------------------------------------------------------------------------- |
| logo_url | string | URL to the logo to render in the banner | | logo_url | string | URL to the logo to render in the banner |
| logo_link_url | string | URL to send the user to when clicking the logo in the banner | | logo_link_url | string | URL to send the user to when clicking the logo in the banner |
| menu | `Menu` | Data to render in the banner menu | | title | string | The title to render next to the logo, falls back to top level `brand` variable if unspecified. |
| menu | `Menu` | Data to render in the banner menu |
The `Menu` type is fulfilled by the following discriminated union: The `Menu` type is fulfilled by the following discriminated union:
+3 -2
View File
@@ -37,9 +37,10 @@ interface Props {
logoUrl: string; logoUrl: string;
href: string; href: string;
menu: ModuleConfig["menu"]; menu: ModuleConfig["menu"];
title: string;
} }
const Banner: FC<Props> = ({ api, logoUrl, href, menu }) => { const Banner: FC<Props> = ({ api, logoUrl, href, menu, title }) => {
let menuJsx; let menuJsx;
switch (menu.type) { switch (menu.type) {
case "static": { case "static": {
@@ -59,7 +60,7 @@ const Banner: FC<Props> = ({ api, logoUrl, href, menu }) => {
<Logo api={api} src={logoUrl} href={href} height="100%" /> <Logo api={api} src={logoUrl} href={href} height="100%" />
</LogoContainer> </LogoContainer>
<Heading size="sm" weight="medium" as="h1"> <Heading size="sm" weight="medium" as="h1">
{api.config.get("brand")} {title}
</Heading> </Heading>
</Root> </Root>
); );
+7
View File
@@ -89,6 +89,13 @@ export const ModuleConfig = z.object({
*/ */
logo_link_url: z.url(), logo_link_url: z.url(),
/**
* The title to show to the right of the Logo
*
* Will fall back to `brand` variable if undefined, can be hidden by setting to the empty string.
*/
title: z.optional(z.string()),
/** /**
* Configuration for the menu. * Configuration for the menu.
*/ */
+1
View File
@@ -47,6 +47,7 @@ class BannerModule implements Module {
logoUrl={this.config.logo_url} logoUrl={this.config.logo_url}
href={this.config.logo_link_url} href={this.config.logo_link_url}
menu={this.config.menu} menu={this.config.menu}
title={this.config.title ?? this.api.config.get("brand")}
/> />
</ThemeProvider>, </ThemeProvider>,
); );