Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ const config: Config = {
],
],
markdown: {
// Copy tags into sidebar props so we can print tags in DocCard
parseFrontMatter: async (params) => {
const frontmatter = await params.defaultParseFrontMatter(params);
frontmatter.frontMatter.sidebar_custom_props ??= {}
// @ts-expect-error Wrong type
frontmatter.frontMatter.sidebar_custom_props.tags = frontmatter.frontMatter.tags
return frontmatter
},
hooks: {
onBrokenMarkdownLinks: process.env.NETLIFY ? 'warn' : 'throw',
onBrokenMarkdownImages: process.env.NETLIFY ? 'warn' : 'throw',
Expand Down
15 changes: 15 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@ table .card{
max-width: 400px;
}

.tag,
a[rel="tag"] {
border: 0.0625rem solid var(--ifm-color-primary);
border-radius: 0.25rem;
padding: 0.125rem 0.5rem;
display: inline-block;
background-color: transparent;
font-weight: 400;
font-size: 0.875rem;
}

.tag {
margin-right: 0.375rem;
}

@media (max-width: 768px) {
table .card{
min-width: 182px;
Expand Down
13 changes: 13 additions & 0 deletions src/theme/DocCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ function CardLayout({
icon,
title,
description,
customProps,
}: {
href: string;
icon: ReactNode;
title: string;
description?: string;
customProps: {[key: string]: unknown} | undefined;
}): ReactNode {
return (
<CardContainer href={href}>
Expand All @@ -77,6 +79,15 @@ function CardLayout({
{description}
</p>
)}
{customProps?.tags && Array.isArray(customProps.tags) ? (
<div className="pill">
{customProps.tags.map((tag) => (
<div className="pills__item pills__item--active tag " key={tag}>
{tag}
</div>
))}
</div>
) : null}
</CardContainer>
);
}
Expand All @@ -97,6 +108,7 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): ReactNode {
title={item.label}
// description={item.description ?? categoryItemsPlural(item.items.length)}
description={item.description}
customProps={item.customProps}
/>
);
}
Expand All @@ -110,6 +122,7 @@ function CardLink({item}: {item: PropSidebarItemLink}): ReactNode {
icon={icon}
title={item.label}
description={item.description ?? doc?.description}
customProps={item.customProps}
/>
);
}
Expand Down