refactor(theme-classic): split theme footer into smaller components + swizzle config (#6894)

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Sébastien Lorber 2022-03-11 14:55:53 +01:00 committed by GitHub
parent c9ee6e467c
commit 1efc6c6091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 416 additions and 180 deletions

View file

@ -20,6 +20,7 @@ export type {
MultiColumnFooter,
SimpleFooter,
Footer,
FooterLogo,
FooterLinkItem,
ColorModeConfig,
} from './utils/useThemeConfig';
@ -110,6 +111,8 @@ export {
type TOCTreeNode,
} from './utils/tocUtils';
export {isMultiColumnFooterLinks} from './utils/footerUtils';
export {
ScrollControllerProvider,
useScrollController,

View file

@ -0,0 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {MultiColumnFooter, SimpleFooter} from './useThemeConfig';
export function isMultiColumnFooterLinks(
links: MultiColumnFooter['links'] | SimpleFooter['links'],
): links is MultiColumnFooter['links'] {
return 'title' in links[0]!;
}

View file

@ -65,18 +65,20 @@ export type FooterLinkItem = {
href?: string;
html?: string;
prependBaseUrlToHref?: string;
} & Record<string, unknown>;
export type FooterLogo = {
alt?: string;
src: string;
srcDark?: string;
width?: string | number;
height?: string | number;
href?: string;
};
export type FooterBase = {
style: 'light' | 'dark';
logo?: {
alt?: string;
src: string;
srcDark?: string;
width?: string | number;
height?: string | number;
href?: string;
};
logo?: FooterLogo;
copyright?: string;
};