Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(docs): also make logo dimensions configurable (#39086)

Charisf0a7e5a5c28c
diff --git a/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx b/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
index 195983325d9..1ae88b582ae 100644
--- a/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
@@ -110,7 +110,7 @@ const TopNavBar: FC = () => {
}
const HeaderLogo = memo(() => {
- const { navigationLogoUrl } = useCustomContent(['navigation:logo_url'])
+ const { navigationLogo } = useCustomContent(['navigation:logo'])
return (
<Link
@@ -122,20 +122,20 @@ const HeaderLogo = memo(() => {
>
<Image
className="hidden dark:block !m-0"
- src={navigationLogoUrl?.dark ?? '/docs/supabase-dark.svg'}
+ src={navigationLogo?.dark ?? '/docs/supabase-dark.svg'}
priority={true}
loading="eager"
- width={96}
- height={18}
+ width={navigationLogo?.width ?? 96}
+ height={navigationLogo?.height ?? 18}
alt="Supabase wordmark"
/>
<Image
className="block dark:hidden !m-0"
- src={navigationLogoUrl?.light ?? '/docs/supabase-light.svg'}
+ src={navigationLogo?.light ?? '/docs/supabase-light.svg'}
priority={true}
loading="eager"
- width={96}
- height={18}
+ width={navigationLogo?.width ?? 96}
+ height={navigationLogo?.height ?? 18}
alt="Supabase wordmark"
/>
<span className="font-mono text-sm font-medium text-brand-link mb-px">DOCS</span>
diff --git a/apps/docs/hooks/custom-content/CustomContent.types.ts b/apps/docs/hooks/custom-content/CustomContent.types.ts
index ece890f25da..ce845cef5b5 100644
--- a/apps/docs/hooks/custom-content/CustomContent.types.ts
+++ b/apps/docs/hooks/custom-content/CustomContent.types.ts
@@ -1,7 +1,9 @@
export type CustomContentTypes = {
homepageHeading: string
- navigationLogoUrl: {
+ navigationLogo: {
light: string
dark: string
+ width?: number
+ height?: number
}
}
diff --git a/apps/docs/hooks/custom-content/custom-content.json b/apps/docs/hooks/custom-content/custom-content.json
index b6fe8d9eea6..71c31154842 100644
--- a/apps/docs/hooks/custom-content/custom-content.json
+++ b/apps/docs/hooks/custom-content/custom-content.json
@@ -1,6 +1,6 @@
{
"homepage:heading": "Supabase Documentation",
- "navigation:logo_url": {
+ "navigation:logo": {
"light": "/docs/supabase-light.svg",
"dark": "/docs/supabase-dark.svg"
}
diff --git a/apps/docs/hooks/custom-content/useCustomContent.test.ts b/apps/docs/hooks/custom-content/useCustomContent.test.ts
index 049d3eb4504..38145d93f5f 100644
--- a/apps/docs/hooks/custom-content/useCustomContent.test.ts
+++ b/apps/docs/hooks/custom-content/useCustomContent.test.ts
@@ -15,19 +15,19 @@ describe('useCustomContent', () => {
it('should return null if content is not found in the custom-content.json file', async () => {
vi.doMock('./custom-content.json', () => ({
default: {
- 'navigation:logo_url': null,
+ 'navigation:logo': null,
},
}))
const { useCustomContent } = await import('./useCustomContent')
- const { result } = renderHook(() => useCustomContent(['navigation:logo_url']))
- expect(result.current.navigationLogoUrl).toEqual(null)
+ const { result } = renderHook(() => useCustomContent(['navigation:logo']))
+ expect(result.current.navigationLogo).toEqual(null)
})
it('should return the content for the key passed in if it exists in the custom-content.json file', async () => {
vi.doMock('./custom-content.json', () => ({
default: {
- 'navigation:logo_url': {
+ 'navigation:logo': {
light: 'https://example.com/logo-light.svg',
dark: 'https://example.com/logo-dark.svg',
},
@@ -36,10 +36,8 @@ describe('useCustomContent', () => {
}))
const { useCustomContent } = await import('./useCustomContent')
- const { result } = renderHook(() =>
- useCustomContent(['navigation:logo_url', 'homepage:heading'])
- )
- expect(result.current.navigationLogoUrl).toEqual({
+ const { result } = renderHook(() => useCustomContent(['navigation:logo', 'homepage:heading']))
+ expect(result.current.navigationLogo).toEqual({
light: 'https://example.com/logo-light.svg',
dark: 'https://example.com/logo-dark.svg',
})