mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 23:40:39 +02:00
fix(theme): apply docs sidebar_class_name
in DocCard + better dogfooding (#10909)
This commit is contained in:
parent
0162f6abc6
commit
b76f0feadc
11 changed files with 97 additions and 33 deletions
|
@ -43,34 +43,38 @@ function useCategoryItemsPlural() {
|
|||
}
|
||||
|
||||
function CardContainer({
|
||||
className,
|
||||
href,
|
||||
children,
|
||||
}: {
|
||||
className?: string;
|
||||
href: string;
|
||||
children: ReactNode;
|
||||
}): ReactNode {
|
||||
return (
|
||||
<Link
|
||||
href={href}
|
||||
className={clsx('card padding--lg', styles.cardContainer)}>
|
||||
className={clsx('card padding--lg', styles.cardContainer, className)}>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
function CardLayout({
|
||||
className,
|
||||
href,
|
||||
icon,
|
||||
title,
|
||||
description,
|
||||
}: {
|
||||
className?: string;
|
||||
href: string;
|
||||
icon: ReactNode;
|
||||
title: string;
|
||||
description?: string;
|
||||
}): ReactNode {
|
||||
return (
|
||||
<CardContainer href={href}>
|
||||
<CardContainer href={href} className={className}>
|
||||
<Heading
|
||||
as="h2"
|
||||
className={clsx('text--truncate', styles.cardTitle)}
|
||||
|
@ -99,6 +103,7 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): ReactNode {
|
|||
|
||||
return (
|
||||
<CardLayout
|
||||
className={item.className}
|
||||
href={href}
|
||||
icon="🗃️"
|
||||
title={item.label}
|
||||
|
@ -112,6 +117,7 @@ function CardLink({item}: {item: PropSidebarItemLink}): ReactNode {
|
|||
const doc = useDocById(item.docId ?? undefined);
|
||||
return (
|
||||
<CardLayout
|
||||
className={item.className}
|
||||
href={item.href}
|
||||
icon={icon}
|
||||
title={item.label}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue