react-code-dataset / wp-calypso /apps /design-system-docs /src /components /link-card-list /index.tsx
react-code-dataset / wp-calypso /apps /design-system-docs /src /components /link-card-list /index.tsx
Download wp-calypso/apps/design-system-docs/src/components/link-card-list/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/design-system-docs/src/components/link-card-list/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/apps/design-system-docs/src/components/link-card-list/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/design-system-docs/src/components/link-card-list/index.tsx
1.02 kB
| import { LinkCard } from '../link-card'; | |
| import styles from './style.module.scss'; | |
| export const LinkCardList = ( { items }: { items: React.ComponentProps< typeof LinkCard >[] } ) => { | |
| return ( | |
| <ul className={ styles[ 'link-card-list' ] }> | |
| { items.map( ( item ) => ( | |
| <li key={ item.href }> | |
| <LinkCard className={ styles[ 'link-card-list__card' ] } { ...item } /> | |
| </li> | |
| ) ) } | |
| </ul> | |
| ); | |
| }; | |
| export const LinkCardListFromMdx = ( { | |
| mdxFiles, | |
| }: { | |
| /** | |
| * Object of imported mdx files with metadata. | |
| */ | |
| mdxFiles: Record< | |
| string, | |
| { | |
| metadata: { | |
| permalink: string; | |
| title: string; | |
| description?: string; | |
| frontMatter: { image?: string }; | |
| }; | |
| assets: { image?: string }; | |
| } | |
| >; | |
| } ) => { | |
| const items = Object.values( mdxFiles ).map( ( { metadata, assets } ) => { | |
| return { | |
| href: metadata.permalink, | |
| label: metadata.title, | |
| description: metadata.description, | |
| image: assets.image ?? metadata.frontMatter.image, | |
| }; | |
| } ); | |
| return <LinkCardList items={ items } />; | |
| }; | |