|
1 | | -import React, {type ReactNode} from 'react'; |
2 | | -import clsx from 'clsx'; |
3 | | -import {ThemeClassNames} from '@docusaurus/theme-common'; |
4 | | -import LinkItem from '@theme/Footer/LinkItem'; |
5 | | -import type {Props} from '@theme/Footer/Links/MultiColumn'; |
| 1 | +import React, { type ReactNode } from "react"; |
| 2 | +import clsx from "clsx"; |
| 3 | +import { ThemeClassNames } from "@docusaurus/theme-common"; |
| 4 | +import LinkItem from "@theme/Footer/LinkItem"; |
| 5 | +import type { Props } from "@theme/Footer/Links/MultiColumn"; |
6 | 6 |
|
7 | | -type ColumnType = Props['columns'][number]; |
8 | | -type ColumnItemType = ColumnType['items'][number]; |
| 7 | +type ColumnType = Props["columns"][number]; |
| 8 | +type ColumnItemType = ColumnType["items"][number]; |
9 | 9 |
|
10 | | -function ColumnLinkItem({item}: {item: ColumnItemType}) { |
11 | | - return item.html ? ( |
12 | | - <li |
13 | | - className={clsx('footer__item', item.className)} |
14 | | - // Developer provided the HTML, so assume it's safe. |
15 | | - // eslint-disable-next-line react/no-danger |
16 | | - dangerouslySetInnerHTML={{__html: item.html}} |
17 | | - /> |
18 | | - ) : ( |
19 | | - <li key={item.href ?? item.to} className="footer__item"> |
20 | | - <LinkItem item={item} /> |
21 | | - </li> |
22 | | - ); |
| 10 | +function ColumnLinkItem({ item }: { item: ColumnItemType }) { |
| 11 | + return item.html ? ( |
| 12 | + <li |
| 13 | + className={clsx("footer__item", item.className)} |
| 14 | + // Developer provided the HTML, so assume it's safe. |
| 15 | + // eslint-disable-next-line react/no-danger |
| 16 | + dangerouslySetInnerHTML={{ __html: item.html }} |
| 17 | + /> |
| 18 | + ) : ( |
| 19 | + <li key={item.href ?? item.to} className="footer__item"> |
| 20 | + <LinkItem item={item} /> |
| 21 | + </li> |
| 22 | + ); |
23 | 23 | } |
24 | 24 |
|
25 | | -function Column({column}: {column: ColumnType}) { |
26 | | - return ( |
27 | | - <div |
28 | | - className={clsx( |
29 | | - ThemeClassNames.layout.footer.column, |
30 | | - 'col footer__col', |
31 | | - column.className, |
32 | | - )}> |
33 | | - <div className="footer__title">{column.title}</div> |
34 | | - <ul className="footer__items clean-list"> |
35 | | - {column.items.map((item, i) => ( |
36 | | - <ColumnLinkItem key={i} item={item} /> |
37 | | - ))} |
38 | | - </ul> |
39 | | - </div> |
40 | | - ); |
| 25 | +function Column({ column }: { column: ColumnType }) { |
| 26 | + return ( |
| 27 | + <div |
| 28 | + className={clsx( |
| 29 | + ThemeClassNames.layout.footer.column, |
| 30 | + "col footer__col", |
| 31 | + column.className |
| 32 | + )} |
| 33 | + > |
| 34 | + <h2 className="footer__title">{column.title}</h2> |
| 35 | + <ul className="footer__items clean-list"> |
| 36 | + {column.items.map((item, i) => ( |
| 37 | + <ColumnLinkItem key={i} item={item} /> |
| 38 | + ))} |
| 39 | + </ul> |
| 40 | + </div> |
| 41 | + ); |
41 | 42 | } |
42 | 43 |
|
43 | | -export default function FooterLinksMultiColumn({columns}: Props): ReactNode { |
44 | | - return ( |
45 | | - <div className="row footer__links"> |
46 | | - {columns.map((column, i) => ( |
47 | | - <Column key={i} column={column} /> |
48 | | - ))} |
49 | | - </div> |
50 | | - ); |
| 44 | +export default function FooterLinksMultiColumn({ columns }: Props): ReactNode { |
| 45 | + return ( |
| 46 | + <div className="row footer__links"> |
| 47 | + {columns.map((column, i) => ( |
| 48 | + <Column key={i} column={column} /> |
| 49 | + ))} |
| 50 | + </div> |
| 51 | + ); |
51 | 52 | } |
0 commit comments