Skip to content

Commit

Permalink
🌆 Move logo into options
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Nov 9, 2023
1 parent 92dc75d commit 3fba918
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
22 changes: 20 additions & 2 deletions packages/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,26 @@ export function updateSiteManifestStaticLinksInplace(
action.url = updateUrl(action.url);
});
// TODO: this needs to be based on the template.yml in the future
if (data.logo) data.logo = updateUrl(data.logo);
if (data.logo_dark) data.logo_dark = updateUrl(data.logo_dark);
// We have moved logo/logo_dark to options in v1.1.28
data.options ??= {};
if (data.logo) {
data.options.logo = data.logo;
delete data.logo;
}
if (data.logo_dark) {
data.options.logo_dark = data.logo_dark;
delete data.logo_dark;
}
if (data.logoText) {
data.options.logo_text = data.logoText;
delete data.logoText;
}
if (data.logo_text) {
data.options.logo_text = data.logo_text;
delete data.logo_text;
}
if (data.options.logo) data.options.logo = updateUrl(data.options.logo);
if (data.options.logo_dark) data.options.logo_dark = updateUrl(data.options.logo_dark);
// Update the thumbnails to point at the CDN
data.projects?.forEach((project) => {
if (project.banner) project.banner = updateUrl(project.banner);
Expand Down
14 changes: 11 additions & 3 deletions packages/site/src/components/ContentBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,17 @@ export function ContentBlocks({
const blocks = mdast.children as GenericParent[];
return (
<>
{blocks.filter((node) => node.visibility !== 'remove').map((node) => (
<Block key={node.key} id={node.key} pageKind={pageKind} node={node} className={className} />
))}
{blocks
.filter((node) => node.visibility !== 'remove')
.map((node) => (
<Block
key={node.key}
id={node.key}
pageKind={pageKind}
node={node}
className={className}
/>
))}
</>
);
}
11 changes: 3 additions & 8 deletions packages/site/src/components/Navigation/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ function HomeLink({
export function TopNav() {
const [open, setOpen] = useNavOpen();
const config = useSiteManifest();
const { logo, logo_dark, logo_text, logoText, actions, title, nav } =
config ?? ({} as SiteManifest);
const { title, nav, actions } = config ?? {};
const { logo, logo_dark, logo_text } = config?.options ?? {};
return (
<div className="bg-white/80 backdrop-blur dark:bg-stone-900/80 shadow dark:shadow-stone-700 p-3 md:px-8 fixed w-screen top-0 z-30 h-[60px]">
<nav className="flex items-center justify-between flex-wrap max-w-[1440px] mx-auto">
Expand All @@ -261,12 +261,7 @@ export function TopNav() {
<span className="sr-only">Open Menu</span>
</button>
</div>
<HomeLink
name={title}
logo={logo}
logoDark={logo_dark}
logoText={logo_text || logoText}
/>
<HomeLink name={title} logo={logo} logoDark={logo_dark} logoText={logo_text} />
</div>
<div className="flex items-center flex-grow w-auto">
<NavItems nav={nav} />
Expand Down

0 comments on commit 3fba918

Please sign in to comment.