import React, { useState } from "react"; import "./CounterDesign.scss"; import blackDisLikeIcon from "../../assets/icons/black-dislike-icon.svg"; import blackLikeIcon from "../../assets/icons/black-like-icon.svg"; import decrementCounterIcon from "../../assets/icons/decrement-counter-icon.svg"; import incrementCounterIcon from "../../assets/icons/increment-counter-icon.svg"; // {deliveryIcon && ( // // )} const CounterDesign = ({ counterColor, counterIncreaseBtn, counterDecreaseBtn, likeBtn, }) => { const [count, setCount] = useState(0); return (

طراحی کانتر

نام این کامپوننت counterDesign است.

{/* counter design */}
{likeBtn && (
setCount(count + 1)} /> setCount(count - 1)} />
)} {counterIncreaseBtn && ( setCount(count + 1)} /> )}

-1 ? count === 0 ? { color: "gray" } : { color: "green" } : { color: "red" } } > {count}

{counterDecreaseBtn && ( setCount(count - 1)} /> )}
); }; export default CounterDesign; // color classes that i defined in tailwind.config.js and we can use for text color: // ----> text-lightBlueTextColor // ----> text-darkRedTextColor CounterDesign.defaultProps = { counterColor: "text-darkRedTextColor", // for icons likeBtn: true, counterIncreaseBtn: true, counterDecreaseBtn: true, };