Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
feat: add a new setting logo_link
Browse files Browse the repository at this point in the history
  • Loading branch information
blahetal committed Jan 19, 2024
1 parent 32684a0 commit 9b155a9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/core/dev-test/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
backend:
name: test-repo
logo_link: '/#/page/custom-page'
site_url: 'https://example.com'
media_folder: /assets/uploads
media_library:
Expand Down
21 changes: 17 additions & 4 deletions packages/core/src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,23 @@ const Navbar: FC<NavbarProps> = ({
<div className={classes.breadcrumbs}>
<div className={classes['logo-wrapper']}>
{config?.logo_url ? (
<div
className={classNames(classes.logo, classes['custom-logo'])}
style={{ backgroundImage: `url('${config.logo_url}')` }}
/>
config.logo_link ? (
<a href={config.logo_link}>
<div
className={classNames(classes.logo, classes['custom-logo'])}
style={{ backgroundImage: `url('${config.logo_url}')` }}
/>
</a>
) : (
<div
className={classNames(classes.logo, classes['custom-logo'])}
style={{ backgroundImage: `url('${config.logo_url}')` }}
/>
)
) : config?.logo_link ? (
<a href={config.logo_link}>
<StaticCmsIcon className={classes.logo} />
</a>
) : (
<StaticCmsIcon className={classes.logo} />
)}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/constants/configSchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ function getConfigSchema() {
display_url: { type: 'string', examples: ['https://example.com'] },
base_url: { type: 'string' },
logo_url: { type: 'string', examples: ['https://example.com/images/logo.svg'] },
logo_link: { type: 'string', examples: ['https://example.com'] },
media_folder: { type: 'string', examples: ['assets/uploads'] },
public_folder: { type: 'string', examples: ['/uploads'] },
media_folder_relative: { type: 'boolean' },
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ export interface Config<EF extends BaseField = UnknownField> {
display_url?: string;
base_url?: string;
logo_url?: string;
logo_link?: string;
media_folder?: string;
public_folder?: string;
media_folder_relative?: boolean;
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/content/docs/configuration-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,19 @@ display_url: 'https://your-site.com',
## Custom Logo

When the `logo_url` setting is specified, the Static CMS UI will change the logo displayed at the top of the login page, allowing you to brand Static CMS with your own logo. `logo_url` is assumed to be a URL to an image file.
When the `logo_link` setting is specified, the Static CMS UI will wrap the logo in a link, allowing you to make the logo clickable. `logo_link` can be a URL to an external page or an address of one of Static CMS pages giving you a quick link to your favourite page.

**Example:**

<CodeTabs>
```yaml
logo_url: https://your-site.com/images/logo.svg
logo_link: https://your-site.com
```

```js
logo_url: 'https://your-site.com/images/logo.svg',
logo_link: 'https://your-site.com',
```

</CodeTabs>
Expand Down

0 comments on commit 9b155a9

Please sign in to comment.