1
0
mirror of synced 2026-01-29 21:01:19 -05:00
Files
docs/components/landing/GuideCards.tsx
Mike Surowiec e0d9a061a3 React category / sub-landing page (#19635)
Re-work routes to use GlobalPage, implements TocLanding, bundle of minor cleanup / fixes
2021-06-02 16:28:39 +00:00

38 lines
1.0 KiB
TypeScript

import { useRouter } from 'next/router'
import Link from 'next/link'
import { ArrowRightIcon } from '@primer/octicons-react'
import { useMainContext } from 'components/context/MainContext'
import { useProductLandingContext } from 'components/context/ProductLandingContext'
import { GuideCard } from 'components/landing/GuideCard'
export const GuideCards = () => {
const router = useRouter()
const { currentCategory } = useMainContext()
const { guideCards } = useProductLandingContext()
const routePath = `/${router.asPath.split('?')[0]}` // remove query string
if (!guideCards) {
return null
}
return (
<div>
<div className="d-lg-flex gutter-lg flex-items-stretch">
{(guideCards || []).map((guide) => {
return <GuideCard key={guide.href} guide={guide} />
})}
</div>
{!currentCategory && (
<Link href={`${routePath}/guides`}>
<a className="btn btn-outline float-right">
Explore guides <ArrowRightIcon />
</a>
</Link>
)}
</div>
)
}