/
IvanWake
/
cookieStore
Обзор
Документация
Войти
/
IvanWake
/
cookieStore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/components/Mobile/MobileCategories.js
54 строки
1 KB
Ivan Wake
fix eader and ooter
25 мар 2024, 18:13
25 мар 2024, 18:13
31804f5
Код
Авторство
О чём код?
import React, { Fragment } from "react"; import { category } from "../../store/styles"; import { useProducts } from "../../store/products-store"; import MobileCategory from "./MobileCategory"; const MobileCategories = () => { const categoryState = useProducts((state) => state.changeCategory); const selectedCategory = useProducts((state) => state.selectedCategory); const categories = [ { id: 'c1', name: 'All' }, { id: 'c2', name: 'Bakery' }, { id: 'c3', name: 'Cookies' }, { id: 'c4', name: 'Icecream' }, { id: 'c5', name: 'Doughnuts' }, ]; const returnCategoryNameHandler = (categoryName) => { categoryState(categoryName) }; return ( <div className="py-4 px-2 mt-[4rem]"> <div className="font-extrabold text-[2.5rem]">{selectedCategory}</div> <div className={category.categoryDiv}> { categories.map((category) => ( <MobileCategory key={category.id} name={category.name} onChangeCategory={returnCategoryNameHandler} selectedCategory={selectedCategory} /> )) } </div> </div> ); } export default MobileCategories;