You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
733 B
JavaScript

import React from 'react'
import Link from 'next/link'
import styles from '../card/style.module.css'
export default function CategoryCard({category}) {
const count = category.items ? category.items.length : category.item_count
return (
<div className={styles.card} style={{display: 'inline-block', maxWidth: 300, margin: 16}}>
<h3><Link href={`/store/category/${category.urlslug}`}><a>{category.name}</a></Link></h3>
<div className={styles['card-text']} style={{textAlign: 'center'}}>{category.description}</div>
<ul className={styles['card-details']}>
<li className={styles['number-in-stock']}>
{count} item{count !== 1 ? 's' : ''}
</li>
</ul>
</div>
)
}