diff --git a/cli/src/getDocusaurusConfig.ts b/cli/src/getDocusaurusConfig.ts index 4f85e69..7a43b80 100644 --- a/cli/src/getDocusaurusConfig.ts +++ b/cli/src/getDocusaurusConfig.ts @@ -42,6 +42,10 @@ export default function getDocusaurusConfig({ ...config.docusaurus, + customFields: { + bannerImage: config.home?.bannerImage + }, + themeConfig: { prism: { additionalLanguages: ["lua"], diff --git a/cli/src/prepareProject.ts b/cli/src/prepareProject.ts index 79d72a9..e39d41d 100644 --- a/cli/src/prepareProject.ts +++ b/cli/src/prepareProject.ts @@ -67,6 +67,7 @@ export type Config = Partial<{ home: Partial<{ enabled: boolean + bannerImage: string includeReadme: boolean features: { diff --git a/cli/template/home/index.js b/cli/template/home/index.js index efee829..44882d3 100644 --- a/cli/template/home/index.js +++ b/cli/template/home/index.js @@ -41,11 +41,22 @@ export function HomepageFeatures() { function HomepageHeader() { const { siteConfig } = useDocusaurusContext() + const bannerImage = siteConfig.customFields.bannerImage + const hasBannerImage = bannerImage ? true : false + const heroBannerStyle = hasBannerImage ? { backgroundImage: `url("${bannerImage}")` } : null + + const titleClassName = clsx("hero__title", { + [styles.titleOnBannerImage]: hasBannerImage + }) + const taglineClassName = clsx("hero__subtitle", { + [styles.taglineOnBannerImage]: hasBannerImage + }) + return ( -
+
-

{siteConfig.title}

-

{siteConfig.tagline}

+

{siteConfig.title}

+

{siteConfig.tagline}