Skip to content

Commit 2520b37

Browse files
committed
feat: add showBrandLogoInSidebar option to customization and update related components
1 parent c1bed43 commit 2520b37

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const admin = new AdminForth({
3030
brandLogo: '@@/assets/logo.svg',
3131
datesFormat: 'DD MMM',
3232
timeFormat: 'HH:mm a',
33-
showBrandNameInSidebar: true,
33+
showBrandNameInSidebar: true,
34+
showBrandLogoInSidebar: true,
3435
emptyFieldPlaceholder: '-',
3536
styles: {
3637
colors: {

adminforth/documentation/docs/tutorial/03-Customization/01-branding.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ showBrandNameInSidebar: false,
5454

5555
`brandName` will still be used in the other places e.g. login form.
5656

57+
## Removing brand logo from sidebar
58+
59+
If you want to hide the logo image in the sidebar while keeping the brand name text (or vice versa), disable the logo with:
60+
61+
```ts title='./index.ts'
62+
brandName: 'My App',
63+
//diff-add
64+
showBrandLogoInSidebar: false,
65+
```
66+
67+
By default, the logo is shown when available. This flag controls the sidebar logo only and does not affect the login page.
68+
5769
## Theming
5870

5971
AdminForth uses TailwindCSS for styling. You are able to customize the look of the application by changing the TailwindCSS configuration.

adminforth/modules/configValidator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ export default class ConfigValidator implements IConfigValidator {
178178
if (customization.showBrandNameInSidebar === undefined) {
179179
customization.showBrandNameInSidebar = true;
180180
}
181+
if (customization.showBrandLogoInSidebar === undefined) {
182+
customization.showBrandLogoInSidebar = true;
183+
}
181184
if (customization.favicon) {
182185
errors.push(...this.checkCustomFileExists(customization.favicon));
183186
}

adminforth/modules/restApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
364364

365365
const loggedInPart = {
366366
showBrandNameInSidebar: this.adminforth.config.customization.showBrandNameInSidebar,
367+
showBrandLogoInSidebar: this.adminforth.config.customization.showBrandLogoInSidebar,
367368
brandLogo: this.adminforth.config.customization.brandLogo,
368369
datesFormat: this.adminforth.config.customization.datesFormat,
369370
timeFormat: this.adminforth.config.customization.timeFormat,

adminforth/spa/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
>
7979
<div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder dark:border-darkSidebarBorder">
8080
<div class="af-logo-title-wrapper flex ms-2 m-4">
81-
<img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="af-logo h-8 me-3" />
81+
<img v-if="coreStore.config?.showBrandLogoInSidebar !== false" :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="af-logo h-8 me-3" />
8282
<span
8383
v-if="coreStore.config?.showBrandNameInSidebar"
8484
class="af-title self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText"

adminforth/types/Back.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,12 @@ interface AdminForthInputConfigCustomization {
647647
*/
648648
showBrandNameInSidebar?: boolean,
649649

650+
/**
651+
* Whether to show brand logo in sidebar
652+
* default is true
653+
*/
654+
showBrandLogoInSidebar?: boolean,
655+
650656
/**
651657
* Path to your app logo
652658
*

adminforth/types/Common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,7 @@ export interface AdminForthConfigForFrontend {
10741074
},
10751075
rememberMeDays: number,
10761076
showBrandNameInSidebar: boolean,
1077+
showBrandLogoInSidebar: boolean,
10771078
brandLogo?: string,
10781079
singleTheme?: 'light' | 'dark',
10791080
datesFormat: string,

0 commit comments

Comments
 (0)