Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding discount % section and border radius #522

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 3 additions & 114 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@
}
.dark_app{
background: white;
}

*{
border-radius: 10px;
}
5 changes: 4 additions & 1 deletion src/Components/Item/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import { ShopContext } from '../../Context/ShopContext'

const Item = (props) => {
const {theme}=useContext(ShopContext);
const discount = (props.old_price)-(props.new_price);
const discount_per = ((discount/props.old_price)*100).toFixed(0);
return (
<div className='item'>
<Link to={`/product/${props.id}`}> <img onClick={window.scrollTo(0,0)} src={props.image} alt="" /></Link>
<p className={`pit_${theme}`}>{props.name}</p><p className={`pit_${theme}`}>{props.id}</p>
<div className="item-prices">
<div className={`item-price-new_${theme}`}>${props.new_price}</div>
<div className={`item-price-old_${theme}`}>${props.old_price}</div>
<div className={`item-price-old_${theme}`}>${props.old_price}</div>
<div style={{color:"red"}}>{`${discount_per}% off`}</div>
</div>
</div>
)
Expand Down