/**
* 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 React from 'react';
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import {
findFirstSidebarItemLink,
useDocById,
} from '@docusaurus/theme-common/internal';
import isInternalUrl from '@docusaurus/isInternalUrl';
import {translate} from '@docusaurus/Translate';
import Heading from '@theme/Heading';
import styles from './styles.module.css';
function CardContainer({href, children}) {
return (
{children}
);
}
function CardLayout({href, icon, title, description}) {
return (
{icon} {title}
{description && (
{description}
)}
);
}
function CardCategory({item}) {
const href = findFirstSidebarItemLink(item);
// Unexpected: categories that don't have a link have been filtered upfront
if (!href) {
return null;
}
return (
);
}
function CardLink({item}) {
const icon = isInternalUrl(item.href) ? '📄️' : '🔗';
const doc = useDocById(item.docId ?? undefined);
return (
);
}
export default function DocCard({item}) {
switch (item.type) {
case 'link':
return ;
case 'category':
return ;
default:
throw new Error(`unknown item type ${JSON.stringify(item)}`);
}
}