diff --git a/src/components/Card/CardWithPicture.jsx b/src/components/Card/CardWithPicture.jsx index e8cd65c2..3505d48a 100644 --- a/src/components/Card/CardWithPicture.jsx +++ b/src/components/Card/CardWithPicture.jsx @@ -83,7 +83,7 @@ export default function CardWithPicture({ tutorial }) { }; const handleDecrement = () => { - setCount(count - 1); + setCount(Math.max(count - 1, 0)); }; const handleAlignment = (event, newAlignment) => { diff --git a/src/components/Card/CardWithoutPicture.jsx b/src/components/Card/CardWithoutPicture.jsx index abc4ecb0..c4a4dbae 100644 --- a/src/components/Card/CardWithoutPicture.jsx +++ b/src/components/Card/CardWithoutPicture.jsx @@ -77,7 +77,7 @@ export default function CardWithoutPicture({ tutorial }) { }; const handleDecrement = () => { - setCount(count - 1); + setCount(Math.max(count - 1, 0)); }; const handleAlignment = (event, newAlignment) => { diff --git a/src/components/TutorialPage/components/Commnets/Comment.jsx b/src/components/TutorialPage/components/Commnets/Comment.jsx index 09e486fc..8f0d8502 100644 --- a/src/components/TutorialPage/components/Commnets/Comment.jsx +++ b/src/components/TutorialPage/components/Commnets/Comment.jsx @@ -89,7 +89,7 @@ const Comment = ({ id }) => { }; const handleDecrement = () => { - setCount(count - 1); + setCount(Math.max(count - 1, 0)); }; const handleAlignment = (event, newAlignment) => { diff --git a/src/components/TutorialPage/components/PostDetails.jsx b/src/components/TutorialPage/components/PostDetails.jsx index 1c46ac63..57f1eb9b 100644 --- a/src/components/TutorialPage/components/PostDetails.jsx +++ b/src/components/TutorialPage/components/PostDetails.jsx @@ -70,7 +70,7 @@ const PostDetails = ({ details }) => { }; const handleDecrement = () => { - setCount(count - 1); + setCount(Math.max(count - 1, 0)); }; const handleAlignment = (event, newAlignment) => {