diff --git a/front/src/features/catalog/CategoryCards.tsx b/front/src/features/catalog/CategoryCards.tsx new file mode 100644 index 0000000..8f07c5d --- /dev/null +++ b/front/src/features/catalog/CategoryCards.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import styles from "./CategoryCards.module.css"; +import { useAppSelector } from "../../app/hooks"; + +interface Props { + onSelect?: (id:number) => void +} + +const CategoryCards: React.FC = ({ onSelect }) => { + const categories = useAppSelector(s => s.categories.items); + + return ( +
+ {categories.map(c => ( +
onSelect?.(c.id)}> + {c.image ? {c.name} : {c.name}} +
{c.name}
+
+ ))} +
+ ); +}; +export default CategoryCards; \ No newline at end of file diff --git a/front/src/types/categories.ts b/front/src/types/categories.ts index 9b332c5..3e813a7 100644 --- a/front/src/types/categories.ts +++ b/front/src/types/categories.ts @@ -12,6 +12,7 @@ export interface CategoryAtributes { export interface Category { id: number; name: string; + image?: string; atributes: CategoryAtributes[]; }