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

add route for contacts, add breadcrumbs for ContactsPage and CartPage #45

Merged
merged 2 commits into from
Sep 12, 2023
Merged
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
4 changes: 3 additions & 1 deletion src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Route,
Routes,
} from 'react-router-dom';
import { Toaster } from 'react-hot-toast';
import App from './App';
import CatalogPage from './pages/CatalogPage';
import NotFoundPage from './pages/NotFoundPage';
Expand All @@ -13,7 +14,7 @@ import ScrollToTop from './components/ScrollToTop';
import FavouritesPage from './pages/FavouritesPage';
import CartPage from './pages/CartPage';
import HomePage from './pages/HomePage';
import { Toaster } from 'react-hot-toast';
import ContactsPage from './pages/ContactsPage';

export const Root = () => (
<BrowserRouter>
Expand All @@ -37,6 +38,7 @@ export const Root = () => (
</Route>
<Route path="favourites" element={<FavouritesPage />} />
<Route path="cart" element={<CartPage />} />
<Route path="contacts" element={<ContactsPage />} />
<Route path="*" element={<NotFoundPage />} />
</Route>
</Routes>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export const Footer = () => {
</li>

<li>
<a
<NavLink
className="duration-150 select-none uppercase text-secondary font-extrabold text-xs hover:text-primary active:text-primary focus:text-primary font-Mont"
href="#"
to="/contacts"
>
Contacts
</a>
</NavLink>
</li>

<li>
Expand Down
18 changes: 6 additions & 12 deletions src/pages/CartPage.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import classNames from 'classnames';
import React, { useState } from 'react';
import { FiChevronLeft } from 'react-icons/fi';
import { NavLink, useNavigate } from 'react-router-dom';
import { useState } from 'react';
import { NavLink } from 'react-router-dom';
import { Button } from '../components/Button';
import CartItem from '../components/CartItem';
import { CheckoutModal } from '../components/CheckoutModal';
import { clearCart, useAppDispatch, useAppSelector } from '../redux';
import { getTotalProductsCost } from '../utils/getTotalCost';
import { getTotalItemsCount } from '../utils/getTotalItemsCount';
import BreadCrumb from '../components/BreadCrumb';

const CartPage = () => {
const { items: cartItems } = useAppSelector((state) => state.cart);
const [showModal, setShowModal] = useState<boolean>(false);
const navigate = useNavigate();
const dispatch = useAppDispatch();

const totalCost = getTotalProductsCost(cartItems);
Expand All @@ -36,17 +35,12 @@ const CartPage = () => {
)}
<main
className={classNames(
'container mx-auto flex flex-col px-4 py-6 tablet:px-6 desktop:w-[1200px] desktop:px-8',
'container mx-auto flex flex-col p-4 pb-6 tablet:px-6 desktop:w-[1200px]',
{ 'blur pointer-events-none': showModal },
)}
>
<span
onClick={() => navigate(-1)}
className="select-none cursor-pointer flex items-center gap-1"
>
<FiChevronLeft />
Back
</span>
<BreadCrumb />

Comment on lines +42 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need it on cart page as I saw on figma

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For next reviewers: we agreed to leave breadcrumps

<div className="mb-8">
<h1 className="mb-2 text-[32px] font-extrabold leading-[41px] tracking-[0.32px] tablet:mt-10 tablet:text-5xl">
Cart
Expand Down
77 changes: 77 additions & 0 deletions src/pages/ContactsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import BreadCrumb from '../components/BreadCrumb';

const ContactsPage = () => {
return (
<main
className="container mx-auto flex flex-col items-center
tablet:items-start p-4 pb-6 tablet:px-6 desktop:w-[1200px]"
>
<BreadCrumb />

<div className="mb-8">
<h1 className="mb-2 text-[32px] font-extrabold leading-[41px] tracking-[0.32px] tablet:mt-10 tablet:text-5xl">
Our Team
</h1>
</div>

<section className="grid grid-cols-1 gap-4 tablet:grid-cols-2 desktop:grid-cols-4">
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
<article
className="card box-border p-8 relative
border border-secondary rounded-lg
min-w-[272px] max-h-[440px]
bg-white
hover:shadow-card tablet:max-h-[506px]"
>
<h2>Olena Vats</h2>
</article>
</section>
</main>
);
};

export default ContactsPage;