diff --git a/src/views/Cart/Item/index.js b/src/views/Cart/Item/index.js index a2ac765..24323e8 100644 --- a/src/views/Cart/Item/index.js +++ b/src/views/Cart/Item/index.js @@ -30,57 +30,58 @@ export default function Item(props) { const { data, handleCounter, handleDelete } = props; return ( - - {data.title} -
- - {data.title} - -

{data.subTitle}

- - {data.options}بسته الحاقی: - -
- - - - {data.price} تومان - - - {data.slicePrice} قیمت هر واحد - - - -
- - - {data.number} - - -
- - - handleDelete(data.id)} - /> - handleDelete(data.id)} - style={{ fontSize: fontSize.desktop.delete.span }} - > - حذف - - + + {data.title} +
+ + {data.title} + +

{data.subTitle}

+ + {data.options}بسته الحاقی: + +
+ + + + {data.price} تومان + + + {data.slicePrice} قیمت هر واحد + + + +
+ + + {data.number} + + +
+ + + handleDelete(data.id)} + /> + handleDelete(data.id)} + style={{ fontSize: fontSize.desktop.delete.span }} + > + حذف + + + ); } diff --git a/src/views/Cart/Item/index.scss b/src/views/Cart/Item/index.scss index f4f5cbd..b161ec3 100644 --- a/src/views/Cart/Item/index.scss +++ b/src/views/Cart/Item/index.scss @@ -1,8 +1,10 @@ .cart-item{ - justify-content: space-between; + // justify-content: space-between; border-top: 1px solid #eee; padding: 15px 0px; &__info{ + flex: 3; + // flex-shrink: 1; img{ height: 100px; border-radius: 10px; @@ -27,6 +29,8 @@ } } &__price{ + flex: 1.5; + flex-shrink: 1; color: #4D4D4F; strong{ font-family: numeralBold; @@ -36,6 +40,9 @@ } } &__counter{ + flex: 1.5; + flex-shrink: 1; + justify-content: center; &--box{ padding: 5px 10px; border: 1px solid rgb(177, 177, 177); @@ -54,6 +61,7 @@ } &__delete{ + flex: 1; margin-left: 20px; span{ font-family: numeralLight; diff --git a/src/views/Cart/Table/index.js b/src/views/Cart/Table/index.js new file mode 100644 index 0000000..04bbd62 --- /dev/null +++ b/src/views/Cart/Table/index.js @@ -0,0 +1,144 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableContainer from '@material-ui/core/TableContainer'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import Paper from '@material-ui/core/Paper'; +import DeleteOutlineOutlinedIcon from "@material-ui/icons/DeleteOutlineOutlined"; + +import './index.scss'; +const useStyles = makeStyles({ + table: { + }, +}); + +const maxMobileSize = 550; + +const fontSize = { + mobile: { + info: { + strong: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 28, + p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36, + span: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36, + }, + price: { + strong: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 22, + span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 40, + }, + counter: { + button: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 25, + span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 25, + }, + delete: { + span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 28, + }, + }, +}; + + + +export default function BasicTable(props) { + const classes = useStyles(); + const {list, handleCounter, handleDelete} = props; + + return ( + <> + { + window.innerWidth < 1000 ? + + + + + محصولات + قیمت + + + + { list.map((row,i) => ( + + ))} + +
+
: null + } + + + ); +} + +// id: 1, +// title: "ریاضیات گسسته خیلی پیشرفته", +// subTitle: "در این قسمت توضیح بسیار کوتاهی قرار می گیرد", +// options: "بسته‌های الحاقی: کیف، کفش و کوله پشتی", +// image: book1, +// slicePrice: 300000, +// number: 1, +// price: 2500000, + +const Item = (props) => { + const {data, handleCounter, handleDelete} = props; + return( + + +
+ + {data.title} +
+ + {data.title} + +

{data.subTitle}

+ + {data.options} + +
+ handleDelete(data.id)} + /> + handleDelete(data.id)} + style={{ fontSize: fontSize.mobile.delete.span, color: "#FC120A"}} + > + حذف + +
+
+
+
+ +
+
+ + {data.price} + + + {data.slicePrice} قیمت هر واحد + +
+
+ + + {data.number} + + +
+
+ +
+
+ ); +} \ No newline at end of file diff --git a/src/views/Cart/Table/index.scss b/src/views/Cart/Table/index.scss new file mode 100644 index 0000000..d6220f9 --- /dev/null +++ b/src/views/Cart/Table/index.scss @@ -0,0 +1,68 @@ +.mobile-cart-table-product{ + width: 100%; + img{ + height: 100px; + width: 70px; + border-radius: 10px; + } + &__info{ + strong, p , span{ + margin: 0px; + font-family: numeralLight; + } + p{ + color: #00CC69; + } + span{ + color: #2580EC; + } + } +} + +.mobile-cart-table-price{ + text-align: center; + &__price{ + strong, span{ + font-family: numeralLight; + } + strong{ + color: #4D4D4F; + } + span{ + color: #4D4D4F; + letter-spacing: -1px; + } + } + &__info{ + strong, p , span{ + margin: 0px; + font-family: numeralLight; + } + p{ + color: #00CC69; + } + span{ + color: #2580EC; + } + } + &__counter{ + padding: 5px 5px; + border: 1px solid rgb(177, 177, 177); + border-radius: 8px; + margin-top: 10px; + button{ + border: 0px; + background-color: white; + color: #4D4D4F; + } + span{ + margin: 0px 15px; + color: #4D4D4F; + + } + } +} + +.MuiTableCell-root{ + padding: 10px 0px !important; +} diff --git a/src/views/Cart/index.js b/src/views/Cart/index.js index 295b192..d68ab60 100644 --- a/src/views/Cart/index.js +++ b/src/views/Cart/index.js @@ -2,6 +2,7 @@ import React, { Component } from "react"; import Navbar from "../Home/Navbar/index"; import Footer from "../Home/Footer/index"; import Item from "./Item/index"; +import Table from "./Table/index"; import book1 from "../../assets/images/book1.png"; @@ -18,6 +19,9 @@ const fontSize = { strong: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90, span: window.innerWidth > maxDesktopSize ? 10 : window.innerWidth / 95, }, + mobile: { + h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 18, + } }; export default class Cart extends Component { state = { @@ -25,9 +29,9 @@ export default class Cart extends Component { list: [ { id: 0, - title: "ریاضیات گسسته خیلی پیشرفته", - subTitle: "در این قسمت توضیح بسیار کوتاهی قرار می گیرد", - options: "بسته‌های الحاقی: کیف، کفش و کوله پشتی", + title: " گسسته ", + subTitle: " گیرد", + options: "بپشتی", image: book1, slicePrice: 200000, number: 1, @@ -91,6 +95,18 @@ export default class Cart extends Component {

سبد خرید

+ + +
+
+ + + + + + + + {this.state.list.map((item, i) => ( ))} +
1234
{this.state.totalPrice ? (
@@ -127,7 +144,21 @@ export default class Cart extends Component {