|
|
|
@ -1,6 +1,8 @@ |
|
|
|
|
import React, { Component } from "react"; |
|
|
|
|
import { Link } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
import basket from "../../../assets/icons/basket.png"; |
|
|
|
|
|
|
|
|
|
import "./index.scss"; |
|
|
|
|
|
|
|
|
|
const maxMobileSize = 550; |
|
|
|
@ -21,36 +23,41 @@ const fontSize = { |
|
|
|
|
} |
|
|
|
|
export default class Product extends Component { |
|
|
|
|
render() { |
|
|
|
|
const { product } = this.props; |
|
|
|
|
const { product, id } = this.props; |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{window.innerWidth < 1000 ? ( |
|
|
|
|
<article className="mobile-products-product d-flex flex-column"> |
|
|
|
|
<Link to={`/products/${product.id}`}> |
|
|
|
|
<img src={product.image} alt={product.title} /> |
|
|
|
|
<h1 style={{ fontSize: fontSize.mobile.h1 }}>{product.title}</h1> |
|
|
|
|
<h2 style={{ fontSize: fontSize.mobile.h2 }}>{product.subTitle}</h2> |
|
|
|
|
{product.price ? ( |
|
|
|
|
<div className="mobile-products-product__price d-flex flex-column align-items-center"> |
|
|
|
|
{product.oldPrice ? ( |
|
|
|
|
<div> |
|
|
|
|
<div style={{ fontSize: fontSize.mobile.div }} className="mobile-products-product__price--old d-flex"> |
|
|
|
|
{product.oldPrice} تومان |
|
|
|
|
<span></span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
<div style={{ fontSize: fontSize.mobile.div }} className="mobile-products-product__price--price"> |
|
|
|
|
{product.price} تومان |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
) : ( |
|
|
|
|
<div style={{ fontSize: fontSize.mobile.div }} className="mobile-products-product__notAvailabe"> |
|
|
|
|
ناموجود |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
<div |
|
|
|
|
className="mobile-mybooks__item d-flex flex-column" |
|
|
|
|
style={{ |
|
|
|
|
borderBottomLeftRadius: Number(id) % 2 === 1 ? 30 : 0, |
|
|
|
|
borderBottomRightRadius: Number(id) % 2 === 0 ? 30 : 0, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<img src={product.image} alt={"عکس مجصول"} /> |
|
|
|
|
<div className="mobile-mybooks__item--buttons d-flex flex-column"> |
|
|
|
|
<Link |
|
|
|
|
style={{ |
|
|
|
|
background: product.status.digital ? "#FFEE00" : "#FFFFFF", |
|
|
|
|
fontSize: fontSize.mobile.a, |
|
|
|
|
color: product.status.ar ? "#4D4D4F" : "#4D4D4F", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
کتاب دیجیتال |
|
|
|
|
{ !product.status.digital ? <img src={basket} alt="افزودن به سبد خرید" /> : null} |
|
|
|
|
</Link> |
|
|
|
|
</article> |
|
|
|
|
<Link |
|
|
|
|
style={{ |
|
|
|
|
background: product.status.ar ? "#00CC69" : "#FFFFFF", |
|
|
|
|
color: product.status.ar ? "#FFFFFF" : "#4D4D4F", |
|
|
|
|
fontSize: fontSize.mobile.a, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
واقعیت افزوده |
|
|
|
|
{ !product.status.ar ? <img src={basket} alt="افزودن به سبد خرید" /> : null} |
|
|
|
|
</Link> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
{window.innerWidth > 1000 ? ( |
|
|
|
|
<article className="products-product d-flex flex-column align-items"> |
|
|
|
@ -83,3 +90,4 @@ export default class Product extends Component { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|