Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for additional text below the sidebar logo #1220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/adminjs-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ export type BrandingOptions = {
* @new since 6.0.0
*/
withMadeWithLove?: boolean;

/**
* Optional additional text below the logo/companyName.
*/
additionalText?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just adding NODE_ENV here:
https://github.com/SoftwareBrothers/adminjs/blob/master/src/frontend/components/app/version.tsx
if it's just to display the environment information?

We can also add additional option to branding but I'd use a different name like logoTitle, logoSubtitle, headerText, headerMessage, menuHeaderMessage, menuHeaderText which would indicate where it'll appear just by looking at it's name.

/**
* URL to a favicon
*/
Expand Down
7 changes: 5 additions & 2 deletions src/frontend/components/app/sidebar/sidebar-branding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const h = new ViewHelpers()
const SidebarBranding: React.FC<Props> = (props) => {
const { branding } = props
const { logo, companyName } = branding
return (
return <>
<StyledLogo
className={cssClass('Logo')}
to={h.dashboardUrl()}
Expand All @@ -55,7 +55,10 @@ const SidebarBranding: React.FC<Props> = (props) => {
/>
) : <h1>{companyName}</h1>}
</StyledLogo>
)
{ branding.additionalText &&
<span>{branding.additionalText}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use Text (import { Text } from '@adminjs/design-system). This uses AdminJS global styles.

}
</>;
}

export default allowOverride(SidebarBranding, 'SidebarBranding')