Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-grapes-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blinkk/root-cms': patch
---

feat: add minimalBranding option for cms (#915)
1 change: 1 addition & 0 deletions packages/root-cms/core/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export async function renderApp(
rootConfig: {
projectId: cmsConfig.id || 'default',
projectName: cmsConfig.name || cmsConfig.id || '',
minimalBranding: cmsConfig.minimalBranding ?? false,
domain: rootConfig.domain || 'https://example.com',
base: rootConfig.base || '/',
gci: gci,
Expand Down
6 changes: 6 additions & 0 deletions packages/root-cms/core/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ export type CMSPluginOptions = {
*/
favicon?: string;

/**
* Enables minimal branding mode in the CMS header. This hides the Root CMS
* logo and displays the project name on the top-right.
*/
minimalBranding?: boolean;

/**
* Callback when an action occurs.
*/
Expand Down
7 changes: 5 additions & 2 deletions packages/root-cms/ui/layout/Layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
}

.Layout__top__logo {
font-size: 14px;
font-size: 15px;
line-height: 1;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
padding: 4px 10px;
display: flex;
gap: 4px;
Expand All @@ -47,6 +46,10 @@
margin-left: 16px;
}

.Layout__top__project--minimal {
margin-left: auto;
}

.Layout__top__logo:hover {
background-color: var(--button-background-hover);
}
Expand Down
27 changes: 19 additions & 8 deletions packages/root-cms/ui/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,27 @@ export function Layout(props: LayoutProps) {
}

Layout.Top = () => {
const projectName =
window.__ROOT_CTX.rootConfig.projectName ||
window.__ROOT_CTX.rootConfig.projectId;
const rootConfig = window.__ROOT_CTX.rootConfig;
const projectName = rootConfig.projectName || rootConfig.projectId;
const minimalBranding = rootConfig.minimalBranding;
return (
<div className="Layout__top">
<a className="Layout__top__logo" href="/cms">
<RootCMSLogo />
</a>
<div className="Layout__top__version">v{packageJson.version}</div>
<div className="Layout__top__project">{projectName}</div>
{!minimalBranding ? (
<>
<a className="Layout__top__logo" href="/cms">
<RootCMSLogo />
</a>
<div className="Layout__top__version">v{packageJson.version}</div>
<div className="Layout__top__project">{projectName}</div>
</>
) : (
<>
<a className="Layout__top__logo" href="/cms">
{projectName}
</a>
<div className="Layout__top__version">v{packageJson.version}</div>
</>
)}
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions packages/root-cms/ui/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ declare global {
rootConfig: {
projectId: string;
projectName: string;
minimalBranding: boolean;
domain: string;
base: string;
gci: string | boolean;
Expand Down