fix: react-doctor modal/dialog/dropzone a11y — 18 files to role+tabIndex+onKeyDown or dialog
This commit is contained in:
@@ -256,10 +256,14 @@ export function CartProvider({ children }: { children: ReactNode }) {
|
||||
}, []);
|
||||
|
||||
const decreaseQuantity = useCallback((id: string) => {
|
||||
setCart((prev) =>
|
||||
prev.map((item) => (item.id === id ? { ...item, quantity: item.quantity - 1 } : item))
|
||||
.filter((item) => item.quantity > 0)
|
||||
);
|
||||
setCart((prev) => {
|
||||
const next = [];
|
||||
for (const item of prev) {
|
||||
const updated = item.id === id ? { ...item, quantity: item.quantity - 1 } : item;
|
||||
if (updated.quantity > 0) next.push(updated);
|
||||
}
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const removeFromCart = useCallback((id: string) => {
|
||||
|
||||
Reference in New Issue
Block a user