Skip to content

Commit

Permalink
add base path to index cards
Browse files Browse the repository at this point in the history
  • Loading branch information
rezrah committed Dec 3, 2023
1 parent 77c0315 commit 2e3c5e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/theme/components/layout/index-cards/IndexCards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Card, Grid} from '@primer/react-brand'
import {MdxFile} from 'nextra'
import {useRouter} from 'next/router'

import styles from './IndexCards.module.css'

Expand All @@ -18,14 +19,15 @@ type DocsItem = MdxFile & {
}

export function IndexCards({route, folderData}: IndexCardsProps) {
const {basePath} = useRouter()
const filteredData = folderData.filter(item => item.kind === 'MdxPage' && item.route.includes(`${route}/`))

return (
<Grid className={styles.IndexCards}>
{filteredData.map((item: DocsItem, index) => {
return (
<Grid.Column span={{medium: 6}} key={`cell-${item.route}`}>
<Card href={item.route} hasBorder style={{width: '100%'}}>
<Card href={`${basePath}${item.route}`} hasBorder style={{width: '100%'}}>
<Card.Heading>{item.frontMatter.title}</Card.Heading>
<Card.Description>{item.frontMatter.description}</Card.Description>
</Card>
Expand Down

0 comments on commit 2e3c5e0

Please sign in to comment.