Skip to content

Commit

Permalink
feat(docusaurus-website): Allow theme override
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Jan 27, 2025
1 parent bb06743 commit 51d92e0
Showing 1 changed file with 82 additions and 75 deletions.
157 changes: 82 additions & 75 deletions modules/docusaurus-website/src/get-default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export type OcularWebsiteConfig = {
/** Search settings */
search?: false | 'local' | ThemeConfig['algolia'];

/** Custom overrides of the theme */
themeConfig?: ThemeConfig;

/** Additional CSS files to include */
customCss?: string[];

Expand All @@ -119,6 +122,7 @@ export function getDocusaurusConfig(config: OcularWebsiteConfig): Config {
examplesDir,
exampleTableOfContents,
webpackConfig = {},
themeConfig = {},
customCss = [],
navbarItems = [],
plugins = []
Expand Down Expand Up @@ -189,82 +193,85 @@ export function getDocusaurusConfig(config: OcularWebsiteConfig): Config {
...plugins
].filter(Boolean),

themeConfig: {
navbar: {
title: projectName,
logo: {
alt: 'vis.gl Logo',
src: '/visgl-logo-dark.png',
srcDark: '/visgl-logo-light.png'
},
items: [
hasExamples && {
to: '/examples',
position: 'left',
label: 'Examples'
},
{
to: '/docs',
position: 'left',
label: 'Docs'
themeConfig: deepmerge(
{
navbar: {
title: projectName,
logo: {
alt: 'vis.gl Logo',
src: '/visgl-logo-dark.png',
srcDark: '/visgl-logo-light.png'
},
{
href: repoUrl,
label: 'GitHub',
position: 'right'
},
...navbarItems
].filter(Boolean)
},
footer: {
style: 'dark',
links: [
{
title: 'Other vis.gl Libraries',
items: [
{
label: 'deck.gl',
href: 'https:/deck.gl'
},
{
label: 'luma.gl',
href: 'https://luma.gl'
},
{
label: 'loaders.gl',
href: 'https://loaders.gl'
},
{
label: 'react-map-gl',
href: 'https://visgl.github.io/react-map-gl'
},
{
label: 'deck.gl-community',
href: 'https://visgl.github.io/deck.gl-community/'
}
].filter((item) => item.label !== projectName)
},
{
title: 'More',
items: [
{
label: 'vis.gl blog on Medium',
href: 'https://medium.com/vis-gl'
},
{
label: 'GitHub',
href: repoUrl
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} OpenJS Foundation`
items: [
hasExamples && {
to: '/examples',
position: 'left',
label: 'Examples'
},
{
to: '/docs',
position: 'left',
label: 'Docs'
},
{
href: repoUrl,
label: 'GitHub',
position: 'right'
},
...navbarItems
].filter(Boolean)
},
footer: {
style: 'dark',
links: [
{
title: 'Other vis.gl Libraries',
items: [
{
label: 'deck.gl',
href: 'https:/deck.gl'
},
{
label: 'luma.gl',
href: 'https://luma.gl'
},
{
label: 'loaders.gl',
href: 'https://loaders.gl'
},
{
label: 'react-map-gl',
href: 'https://visgl.github.io/react-map-gl'
},
{
label: 'deck.gl-community',
href: 'https://visgl.github.io/deck.gl-community/'
}
].filter((item) => item.label !== projectName)
},
{
title: 'More',
items: [
{
label: 'vis.gl blog on Medium',
href: 'https://medium.com/vis-gl'
},
{
label: 'GitHub',
href: repoUrl
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} OpenJS Foundation`
},
algolia: typeof search === 'object' ? search : undefined,
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme
}
},
algolia: typeof search === 'object' ? search : undefined,
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme
}
} as ThemeConfig
themeConfig
) as ThemeConfig
} as Config;
}

0 comments on commit 51d92e0

Please sign in to comment.