diff --git a/src/components/SoftwareSelector/CategorySection.jsx b/src/components/SoftwareSelector/CategorySection.jsx index e5ab365..a830696 100644 --- a/src/components/SoftwareSelector/CategorySection.jsx +++ b/src/components/SoftwareSelector/CategorySection.jsx @@ -1,38 +1,80 @@ import { useState } from 'react'; import SoftwareCard from './SoftwareCard'; +import { useSelection } from '../../context/SelectionContext'; const CategorySection = ({ category, software }) => { const [expanded, setExpanded] = useState(true); + const { isAllCategorySelected, selectAllInCategory, deselectAllInCategory } = useSelection(); + + const allSelected = isAllCategorySelected(category.id); + + const handleSelectAll = (e) => { + e.stopPropagation(); + if (allSelected) { + deselectAllInCategory(category.id); + } else { + selectAllInCategory(category.id); + } + }; return (
-
+
+ +