diff --git a/packages/docusaurus-theme-classic/src/options.ts b/packages/docusaurus-theme-classic/src/options.ts index 7bd6253565cf..6827c069bcbb 100644 --- a/packages/docusaurus-theme-classic/src/options.ts +++ b/packages/docusaurus-theme-classic/src/options.ts @@ -308,6 +308,7 @@ const FooterLinkItemSchema = Joi.object({ href: URISchema, html: Joi.string(), label: Joi.string(), + className: Joi.string(), }) .xor('to', 'href', 'html') .with('to', 'label') @@ -317,6 +318,12 @@ const FooterLinkItemSchema = Joi.object({ // attributes like target, aria-role, data-customAttribute...) .unknown(); +const FooterColumnItemSchema = Joi.object({ + title: Joi.string().allow(null).default(null), + className: Joi.string(), + items: Joi.array().items(FooterLinkItemSchema).default([]), +}); + const LogoSchema = Joi.object({ alt: Joi.string().allow(''), src: Joi.string().required(), @@ -384,12 +391,7 @@ export const ThemeConfigSchema = Joi.object({ logo: LogoSchema, copyright: Joi.string(), links: Joi.alternatives( - Joi.array().items( - Joi.object({ - title: Joi.string().allow(null).default(null), - items: Joi.array().items(FooterLinkItemSchema).default([]), - }), - ), + Joi.array().items(FooterColumnItemSchema), Joi.array().items(FooterLinkItemSchema), ) .messages({ diff --git a/packages/docusaurus-theme-classic/src/theme/Footer/LinkItem/index.tsx b/packages/docusaurus-theme-classic/src/theme/Footer/LinkItem/index.tsx index 8f6f09a8753e..ac4f6b488dd3 100644 --- a/packages/docusaurus-theme-classic/src/theme/Footer/LinkItem/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Footer/LinkItem/index.tsx @@ -6,7 +6,7 @@ */ import React, {type ReactNode} from 'react'; - +import clsx from 'clsx'; import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import isInternalUrl from '@docusaurus/isInternalUrl'; @@ -14,13 +14,13 @@ import IconExternalLink from '@theme/Icon/ExternalLink'; import type {Props} from '@theme/Footer/LinkItem'; export default function FooterLinkItem({item}: Props): ReactNode { - const {to, href, label, prependBaseUrlToHref, ...props} = item; + const {to, href, label, prependBaseUrlToHref, className, ...props} = item; const toUrl = useBaseUrl(to); const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true}); return ( +
{column.title}