Skip to content

Commit

Permalink
Merge pull request #20 from fs-jun24-team-3/featch/cartLayout
Browse files Browse the repository at this point in the history
Featch/cart layout
  • Loading branch information
k-marchuk authored Sep 17, 2024
2 parents 3c7b181 + afb0287 commit fa5d711
Show file tree
Hide file tree
Showing 18 changed files with 421 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const App = () => {
<>
<Header />
<Outlet />

<Footer />
</>
);
Expand Down
7 changes: 5 additions & 2 deletions src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { store } from './app/store';
import { HashRouter, Navigate, Route, Routes } from 'react-router-dom';
import App from './App';
import { MainPage } from './pages/MainPage';
// import { PhonesPage } from './pages/PhonesPage/PhonesPage';

import { TabletsPage } from './pages/TabletspPage/TabletsPage';
import { AccessoriesPage } from './pages/AccessoriesPage/AccessoriesPage';
import { CartPage } from './pages/CartPage/CartPage';

import { NotFoundPage } from './pages/NotFoundPage';
import { PhonesPage } from './pages/PhonesPage/PhonesPage';

Expand All @@ -25,7 +27,8 @@ export const Root = () => {

<Route path="tablets" element={<TabletsPage />} />
<Route path="accessories" element={<AccessoriesPage />} />
{/* <Route path="cart" element={<CartPag />} /> */}
<Route path="cart" element={<CartPage />} />

<Route path="*" element={<NotFoundPage />} />
</Route>
</Routes>
Expand Down
36 changes: 26 additions & 10 deletions src/components/Header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #e2e6e9;
border-bottom: 1px solid $elemnts-color;
position: relative;

background-color: #fff;
&__menu {
display: flex;
align-items: center;
Expand Down Expand Up @@ -67,10 +67,6 @@
margin: 24px;
display: block;
}

// @include onMobile {
// display: none;
// }
}

&--menu {
Expand All @@ -90,8 +86,8 @@

&__icon--like {
display: block;
border-right: 1px solid #e2e6e9;
border-left: 1px solid #e2e6e9;
border-right: 1px solid $elemnts-color;
border-left: 1px solid $elemnts-color;
display: none;

@include onTablet {
Expand All @@ -101,11 +97,31 @@

&__icon--menu {
display: block;
border-right: 1px solid #e2e6e9;
border-left: 1px solid #e2e6e9;
border-right: 1px solid $elemnts-color;
border-left: 1px solid $elemnts-color;

@include onTablet {
display: none;
}
}
&__icon--basket {
position: relative;
}
&__icon--active {
&::after {
content: '';
position: absolute;
display: block;
width: 100%;
height: 3px;

@include onTablet {
bottom: -18px;
}
@include onDesktop {
bottom: 0px;
}
background-color: #000;
}
}
}
14 changes: 11 additions & 3 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NavHeader } from './NavHeader';
import './Header.scss';
import logo from '../../img/Logo.png';
import { NavLink } from 'react-router-dom';
import classNames from 'classnames';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};
Expand All @@ -21,9 +22,16 @@ export const Header: React.FC<Props> = () => {
<div className="header__icon--like">
<div className="header__icons--like"></div>
</div>
<div className="header__icon--basket">
<NavLink to="/cart" className="header__icons--basket"></NavLink>
</div>
<NavLink
to="/cart"
className={({ isActive }) =>
classNames('header__icon--basket', {
'header__icon--active': isActive,
})
}
>
<div className="header__icons--basket"></div>
</NavLink>
<div className="header__icon--menu">
<div className="header__icons--menu"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/NavHeader/NavHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
font-size: 12px;
line-height: 11px;
letter-spacing: 4%;
color: #89939a;
color: $secondary-color;
@include onTablet {
&:not(:last-child) {
margin-right: 36px;
Expand Down
Binary file modified src/img/arrowActive/ArrowLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/imageIphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions src/pages/CartPage/CartItem/CartItem.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.cartItem {
align-items: center;
border: 1px solid $elemnts-color;
background-color: #fff;
border-radius: 16px;
padding: 16px;
grid-column: 1/-1;

@include onTablet {
padding: 24px;
grid-column: 1/-1;
}
@include onDesktop {
grid-column: 1/-10;
}

&__close {
width: 16px;
height: 16px;
background-image: url(../../../img/icon/Close.png);
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
&__count {
display: flex;
align-items: center;
&--button {
background-color: #fff;
display: block;
width: 32px;
height: 32px;
border: 1px solid $elemnts-color;
border-radius: 32px;
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
&-minus {
width: 16px;
height: 16px;
}
&-plus {
width: 16px;
height: 16px;
}
}
&__number {
margin-left: 8px;
margin-right: 8px;
font-size: 14px;
font-weight: 600;
line-height: 21px;
}
}
&__name {
width: 128px;
}
&__price {
color: $primary-color;
font-weight: 800;
font-size: 22px;
line-height: 30px;
}
&:not(:last-child) {
margin-bottom: 16px;
}
}
.block {
&__information {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
&__price {
display: flex;
justify-content: space-between;
align-items: center;
}
}
34 changes: 34 additions & 0 deletions src/pages/CartPage/CartItem/CartItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { Cart } from '../../../type/Cart';
import minus from '../../../img/icon/Minus.png';
import plus from '../../../img/icon/Plus.png';
import './CartItem.scss';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {
cart: Cart;
};

export const CartItem: React.FC<Props> = ({ cart }) => {
return (
<div className="cartItem">
<div className="block__information">
<div className="cartItem__close"></div>
<img src={cart.img} />
<div className="cartItem__name">{cart.title}</div>
</div>
<div className="block__price">
<div className="cartItem__count">
<button className="cartItem__count--button">
<img src={minus} className="cartItem__count--button-minus" />
</button>
<div className="cartItem__count__number">{cart.count}</div>
<button className="cartItem__count--button">
<img src={plus} className="cartItem__count--button-plus" />
</button>
</div>
<div className="cartItem__price">${cart.price}</div>
</div>
</div>
);
};
78 changes: 78 additions & 0 deletions src/pages/CartPage/CartPage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.cart {
@include mainContentGrid;

&__rout {
display: flex;
margin-top: 24px;
margin-bottom: 16px;
&__img {
width: 16px;
height: 16px;
background-image: url(../../img/arrowActive/ArrowLeft.png);
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
&__name {
font-weight: 700;
color: #89939a;
font-size: 12px;
line-height: 15px;
margin-left: 4px;
}
}
&__title {
font-weight: 800;
font-size: 32px;
line-height: 41px;
letter-spacing: -1%;
margin-bottom: 32px;
@include onTablet {
font-size: 48px;
line-height: 56px;
}
}
&__items {
@include mainPageGrid;
grid-column: 1/-1;
}
&__total-count {
border: 1px solid $elemnts-color;
border-radius: 16px;
padding: 24px;
margin-bottom: 56px;
grid-column: 1/-1;
display: flex;
flex-direction: column;
align-items: center;
@include onDesktop {
grid-column: 17/-1;
grid-row: 1;
}
&__price {
color: #0f0f11;
font-weight: 800;
font-size: 32px;
letter-spacing: -1%;
}
&__text {
color: $secondary-color;
font-weight: 600;
font-size: 14px;
line-height: 21px;
}
&__line {
height: 1px;
width: 100%;
background-color: $elemnts-color;
margin: 16px 0;
@include onDesktop {
margin: 25px 0 24px 0;
}
}
&__button-checkout {
width: 100%;
height: 48px;
}
}
}
Loading

0 comments on commit fa5d711

Please sign in to comment.