feat(theme-classic): themeConfig navbar/footer logos accept className/style + update Meta Open-Source Logo (#7643)

This commit is contained in:
Sébastien Lorber 2022-06-23 11:22:27 +02:00 committed by GitHub
parent a989a1d17e
commit 42ab07f62f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 102 additions and 83 deletions

View file

@ -300,6 +300,18 @@ const CustomCssSchema = Joi.alternatives()
.try(Joi.array().items(Joi.string().required()), Joi.string().required())
.optional();
const LogoSchema = Joi.object({
alt: Joi.string().allow(''),
src: Joi.string().required(),
srcDark: Joi.string(),
width: Joi.alternatives().try(Joi.string(), Joi.number()),
height: Joi.alternatives().try(Joi.string(), Joi.number()),
href: Joi.string(),
target: Joi.string(),
style: Joi.object(),
className: Joi.string(),
});
export const ThemeConfigSchema = Joi.object<ThemeConfig>({
// TODO temporary (@alpha-58)
// @ts-expect-error: forbidden
@ -344,28 +356,11 @@ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
.items(NavbarItemSchema)
.default(DEFAULT_CONFIG.navbar.items),
title: Joi.string().allow('', null),
logo: Joi.object({
alt: Joi.string().allow(''),
src: Joi.string().required(),
srcDark: Joi.string(),
width: Joi.alternatives().try(Joi.string(), Joi.number()),
height: Joi.alternatives().try(Joi.string(), Joi.number()),
href: Joi.string(),
target: Joi.string(),
}),
logo: LogoSchema,
}).default(DEFAULT_CONFIG.navbar),
footer: Joi.object({
style: Joi.string().equal('dark', 'light').default('light'),
logo: Joi.object({
alt: Joi.string().allow(''),
src: Joi.string().required(),
srcDark: Joi.string(),
// TODO infer this from reading the image
width: Joi.alternatives().try(Joi.string(), Joi.number()),
height: Joi.alternatives().try(Joi.string(), Joi.number()),
href: Joi.string(),
target: Joi.string(),
}),
logo: LogoSchema,
copyright: Joi.string(),
links: Joi.alternatives(
Joi.array().items(