feat: allow specifying custom target for FooterLogo (#7557)

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Le Thi Van 2022-06-03 17:28:27 +02:00 committed by GitHub
parent 9d0bf2e090
commit 5444a230cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View file

@ -102,6 +102,7 @@ describe('themeConfig', () => {
alt: 'Facebook Open Source Logo', alt: 'Facebook Open Source Logo',
src: 'img/oss_logo.png', src: 'img/oss_logo.png',
href: 'https://opensource.facebook.com', href: 'https://opensource.facebook.com',
target: '_self',
}, },
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc. Built with Docusaurus.`, copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc. Built with Docusaurus.`,
}, },

View file

@ -32,7 +32,10 @@ function LogoImage({logo}: Props) {
export default function FooterLogo({logo}: Props): JSX.Element { export default function FooterLogo({logo}: Props): JSX.Element {
return logo.href ? ( return logo.href ? (
<Link href={logo.href} className={styles.footerLogoLink}> <Link
href={logo.href}
className={styles.footerLogoLink}
target={logo.target}>
<LogoImage logo={logo} /> <LogoImage logo={logo} />
</Link> </Link>
) : ( ) : (

View file

@ -364,6 +364,7 @@ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
width: Joi.alternatives().try(Joi.string(), Joi.number()), width: Joi.alternatives().try(Joi.string(), Joi.number()),
height: Joi.alternatives().try(Joi.string(), Joi.number()), height: Joi.alternatives().try(Joi.string(), Joi.number()),
href: Joi.string(), href: Joi.string(),
target: Joi.string(),
}), }),
copyright: Joi.string(), copyright: Joi.string(),
links: Joi.alternatives( links: Joi.alternatives(

View file

@ -75,6 +75,7 @@ export type FooterLogo = {
srcDark?: string; srcDark?: string;
width?: string | number; width?: string | number;
height?: string | number; height?: string | number;
target?: string;
href?: string; href?: string;
}; };