From 0e10124626d53231da96a582439ff02f2b392f35 Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: Tue, 28 Apr 2026 14:59:45 +0200 Subject: [PATCH] Adapt max logo height (#4218) --- .../gitbook/src/components/Header/HeaderLogo.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/gitbook/src/components/Header/HeaderLogo.tsx b/packages/gitbook/src/components/Header/HeaderLogo.tsx index a322e313b..816bc0cdb 100644 --- a/packages/gitbook/src/components/Header/HeaderLogo.tsx +++ b/packages/gitbook/src/components/Header/HeaderLogo.tsx @@ -11,6 +11,14 @@ interface HeaderLogoProps { context: GitBookSiteContext; } +/** + * We previously gave the logo too much height, making it too big to look good. + * As a response, many orgs added padding inside their logos to make them look better. + * The new logo max-height looks better but might make existing logos look too small. + * To avoid disruption, we only use the new (correct) logo height for logos updated after this date. + */ +const HEADER_COMPACT_LOGO_DATE = '2026-04-28T00:00:00.000Z'; + /** * Render the logo for a space using the customization settings. */ @@ -18,6 +26,10 @@ interface HeaderLogoProps { export async function HeaderLogo(props: HeaderLogoProps) { const { context } = props; const { customization, linker } = context; + const canUseCompactHeaderLogo = + customization.updatedAt && + !Number.isNaN(Date.parse(customization.updatedAt)) && + Date.parse(customization.updatedAt) >= Date.parse(HEADER_COMPACT_LOGO_DATE); const primaryLink = customization.header.primaryLink ? await resolveContentRef(customization.header.primaryLink, context) @@ -59,7 +71,7 @@ export async function HeaderLogo(props: HeaderLogoProps) { 'max-w-40', 'lg:max-w-64', 'lg:site-header-none:page-no-toc:max-w-56', - 'max-h-10', + canUseCompactHeaderLogo ? 'max-h-8' : 'max-h-10', 'h-full', 'w-full', 'object-contain',