Skip to content

Commit 05b8e6a

Browse files
dark logo: navbar
1 parent 8b40356 commit 05b8e6a

File tree

10 files changed

+65
-34
lines changed

10 files changed

+65
-34
lines changed

src/project/types/website/website-navigation.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,13 +1015,15 @@ async function sidebarEjsData(project: ProjectContext, sidebar: Sidebar) {
10151015

10161016
// ensure title and search are present
10171017
sidebar.title = await sidebarTitle(sidebar, project) as string | undefined;
1018-
// sidebar logo has been normalized
1019-
const sidebarLogo = sidebar.logo as NormalizedLogoLightDarkSpecifier;
1020-
if (sidebarLogo.light) {
1021-
sidebarLogo.light.path = resolveLogo(sidebarLogo.light.path)!;
1022-
}
1023-
if (sidebarLogo.dark) {
1024-
sidebarLogo.dark.path = resolveLogo(sidebarLogo.dark.path)!;
1018+
if (sidebar.logo) {
1019+
// sidebar logo has been normalized
1020+
const sidebarLogo = sidebar.logo as NormalizedLogoLightDarkSpecifier;
1021+
if (sidebarLogo.light) {
1022+
sidebarLogo.light.path = resolveLogo(sidebarLogo.light.path)!;
1023+
}
1024+
if (sidebarLogo.dark) {
1025+
sidebarLogo.dark.path = resolveLogo(sidebarLogo.dark.path)!;
1026+
}
10251027
}
10261028
const searchOpts = await searchOptions(project);
10271029
sidebar.search = sidebar.search !== undefined
@@ -1257,6 +1259,7 @@ async function navbarEjsData(
12571259
pinned: navbar.pinned !== undefined ? !!navbar.pinned : false,
12581260
};
12591261
if (data.logo) {
1262+
console.log("navbar logo", navbar.logo);
12601263
// navbar logo has been normalized
12611264
const navbarLogo = navbar.logo as NormalizedLogoLightDarkSpecifier;
12621265
if (navbarLogo.light) {

src/project/types/website/website-shared.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ export async function websiteNavigationConfig(project: ProjectContext) {
135135
logo = { path: logo, alt: navbar[kLogoAlt] };
136136
}
137137
}
138+
139+
// note no document-level customization of brand logo #11309
138140
const brand = await projectResolveBrand(project);
139141
navbar.logo = await normalizeLogoSpec(brand, logo);
140142
}
@@ -162,7 +164,6 @@ export async function websiteNavigationConfig(project: ProjectContext) {
162164
}
163165

164166
if (sidebars[0].logo) {
165-
// note no document-level customization of brand logo #11309
166167
let logo = sidebars[0].logo;
167168
if (sidebars[0][kLogoAlt]) {
168169
const alt = sidebars[0][kLogoAlt];
@@ -189,6 +190,7 @@ export async function websiteNavigationConfig(project: ProjectContext) {
189190
// };
190191
// }
191192
}
193+
// note no document-level customization of brand logo #11309
192194
const brand = await projectResolveBrand(project);
193195
sidebars[0].logo = await normalizeLogoSpec(brand, logo);
194196
}
@@ -234,17 +236,19 @@ export async function websiteNavigationConfig(project: ProjectContext) {
234236
if (
235237
projectBrand?.light?.processedData.logo && navbar
236238
) {
237-
const light = projectBrand.light.processedData.logo.small ??
238-
projectBrand.light.processedData.logo.medium ??
239-
projectBrand.light.processedData.logo.large;
240-
const dark = projectBrand.dark?.processedData.logo.small ??
241-
projectBrand.dark?.processedData.logo.medium ??
242-
projectBrand.dark?.processedData.logo.large;
243-
if (light || dark) {
244-
navbar.logo = {
245-
light,
246-
dark,
247-
};
239+
if (navbar.logo === undefined) {
240+
const light = projectBrand.light.processedData.logo.small ??
241+
projectBrand.light.processedData.logo.medium ??
242+
projectBrand.light.processedData.logo.large;
243+
const dark = projectBrand.dark?.processedData.logo.small ??
244+
projectBrand.dark?.processedData.logo.medium ??
245+
projectBrand.dark?.processedData.logo.large;
246+
if (light || dark) {
247+
navbar.logo = {
248+
light,
249+
dark,
250+
};
251+
}
248252
}
249253
}
250254

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}

tests/docs/smoke-all/brand/logo/navbar/brand-override-resources/_quarto.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ website:
88
id: navbar-id
99
style: "docked"
1010
logo:
11-
light: moon
12-
dark: sun
11+
light: { path: moon }
12+
dark: { path: sun, alt: "SUN FACE" }
1313
search: true
1414
contents:
1515
- index.qmd
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}

tests/docs/smoke-all/brand/logo/navbar/brand-override-resources/index.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ _quarto:
55
html:
66
ensureHtmlElements:
77
-
8-
- 'img[class*="dark-content"][src="./sun-face.png"][alt=""]'
8+
- 'img[class*="dark-content"][src="./sun-face.png"][alt="SUN FACE"]'
99
- 'img[class*="light-content"][src="./moon-face.png"][alt=""]'
1010
- []
1111
---
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/*-- scss:rules --*/
22

33
nav.sidebar.sidebar-navigation:not(.rollup) {
4-
background-color: #282B30;
5-
}
4+
background-color: #282b30;
5+
}
6+
7+
nav.navbar {
8+
background-color: rgba(13, 108, 251, 25%);
9+
}

0 commit comments

Comments
 (0)