mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-24 03:58:49 +02:00
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:
parent
c9ee6e467c
commit
1efc6c6091
14 changed files with 416 additions and 180 deletions
|
@ -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,
|
||||
|
|
14
packages/docusaurus-theme-common/src/utils/footerUtils.ts
Normal file
14
packages/docusaurus-theme-common/src/utils/footerUtils.ts
Normal 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]!;
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue