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

Develop #192

Open
wants to merge 20 commits 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ to links container.
### Other tasks
1. Add `NotFoundPage` containing text `Page not found` for all the other URLs with the link to `HomePage`
1. Implement `Phone was not found` state for the `PhoneDetailsPage` if there is no phone with a given `phoneId` on the server


223 changes: 165 additions & 58 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@
"dependencies": {
"@cypress/react": "^5.12.4",
"bulma": "^0.9.3",
"classnames": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^4.0.3"
"react-redux": "^8.1.1",
"react-router-dom": "^6.14.2",
"react-scripts": "^4.0.3",
"react-transition-group": "^4.4.5",
"redux": "^4.2.1"
},
"devDependencies": {
"@cypress/webpack-dev-server": "^1.8.4",
"@mate-academy/cypress-tools": "^1.0.4",
"@mate-academy/eslint-config-react": "*",
"@mate-academy/eslint-config-react-typescript": "*",
"@mate-academy/scripts": "^1.2.1",
"@mate-academy/scripts": "^1.2.8",
"@mate-academy/students-ts-config": "*",
"@mate-academy/stylelint-config": "*",
"@types/node": "^17.0.23",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@types/react-transition-group": "^4.4.6",
"cypress": "^9.5.3",
"eslint": "^7.32.0",
"eslint-plugin-cypress": "^2.11.2",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Phone catalog</title>
<link rel="icon" href="./img/iconForPage.svg">
</head>
<body>
<div id="root"></div>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
82 changes: 76 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,79 @@
import { Route, Routes, useLocation } from 'react-router-dom';
import './App.scss';
import { useEffect } from 'react';
import { FavoriteContextProvider }
from './core/context/FavoriteContext/FavoriteContext';
import {
Header,
HomePage,
NotFoundPage,
PhonePreview,
PhonesPage,
ContactsPage,
Favorite,
Basket,
Rights,
Footer,
}
from './Components';

const App = () => (
<div className="App">
<h1>React Phone Catalog</h1>
</div>
);
export const App = () => {
const location = useLocation();

export default App;
useEffect(() => {
window.scrollTo(0, 0);
}, [location]);

return (
<FavoriteContextProvider>
<Header searchValue="" setSearchValue={() => null} />

<div className="main">
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/phones" element={<PhonesPage />} />
<Route path="/phones/:id" element={<PhonePreview />} />
<Route
path="/tablets"
element={(
<NotFoundPage
title="Tables"
h1="Tablet page under construction"
text="
the tablet page is not ready yet, we suggest you return to the"
/>
)}
/>
<Route
path="/accessories"
element={(
<NotFoundPage
title="Accessories"
h1="Accessories page under construction"
text="
accessories page is not ready yet, we suggest you return to the"
/>
)}
/>
<Route path="/favorites" element={<Favorite />} />
<Route path="/cart" element={<Basket />} />
<Route path="/contacts" element={<ContactsPage />} />
<Route path="/rights" element={<Rights />} />
<Route
path="*"
element={(
<NotFoundPage
title="Page Not Found!"
h1="Page Not Found!"
text="sorry, it looks like you got lost,
we suggest you return to the"
/>
)}
/>
</Routes>
</div>

<Footer />
</FavoriteContextProvider>
);
};
5 changes: 5 additions & 0 deletions src/Components/Footer/Footer-images/Arrow.svg
6 changes: 6 additions & 0 deletions src/Components/Footer/Footer-images/LOGO.svg
9 changes: 9 additions & 0 deletions src/Components/Footer/Footer-images/basket.svg
5 changes: 5 additions & 0 deletions src/Components/Footer/Footer-images/heart.svg
125 changes: 125 additions & 0 deletions src/Components/Footer/Footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
html {
scroll-behavior: smooth;
}

.header-position {
position: absolute;
left: 0;
top: 0;
right: 0;
}

.footer {
height: 96px;
box-shadow: 0px -1px 0px 0px #e2e6e9;
background: #ffffff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 90px;

&__FirstChild {
display: flex;
align-items: center;
gap: 64px;
}

&__FirstChild-nav {
&-list {
margin: 0;
padding: 0;
display: flex;
list-style: none;
font-size: 12px;
font-family: "Mont-Regular", sans-serif;
font-weight: 700;
text-transform: uppercase;
line-height: 5.5;
letter-spacing: 0.48;
word-wrap: break-word;
overflow: hidden;
}

&-link {
display: flex;
position: relative;
text-decoration: none;
color: #89939a;
transition: 0.3s;
&:hover {
color: #313237;
}
}
}

&__FirstChild-nav-item:not(:last-child) {
margin-right: 64px;
}

&__LastChild-arrow {
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
flex-shrink: 0;
background: #fff;
border: 1px solid #b4bdc3;
transition: 0.3s;
&:hover,
&:focus,
&:active {
box-shadow: 1px 0px 0px 0px #747779;
box-shadow: -1px 0px 0px 0px #747779;
}
}
}

.arrow-svg {
cursor: pointer;
background-size: cover;
background-repeat: no-repeat;
height: 20px;
width: 23px;
}

.arrow-button {
border: none;
background-color: transparent;
padding: 0;
cursor: pointer;
}

.logoImage {
height: 24px;
width: 40px;
background-repeat: no-repeat;
transition: 0.3s;
&:hover {
cursor: pointer;
}
}

.footer__ThridChild {
display: flex;
align-items: center;
gap: 16px;
}

.footer-p {
color: #89939a;
text-align: right;
font-size: 12px;
font-family: "Mont-Regular", sans-serif;
font-weight: 600;
}

.is-activee {
display: flex;
position: relative;
text-decoration: none;
color: #313237;
transition: 0.3s;
}

$variable: 10px;
79 changes: 79 additions & 0 deletions src/Components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import './Footer.scss';
import { Link, useLocation } from 'react-router-dom';
import { FC } from 'react';
import ArrowImage from './Footer-images/Arrow.svg';
import LogoImage from './Footer-images/LOGO.svg';

export const Footer: FC = () => {
const location = useLocation();

const handleScrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
};

return (
<footer className="footer">
<div className="footer__FirstChild">
<div className="footer__FirstChild-logo">
<Link to="/">
<img className="logoImage" src={LogoImage} alt="Logo" />
</Link>
</div>
</div>

<div className="footer__TwoChild">
<nav className="footer__FirstChild-nav">
<ul className="footer__FirstChild-nav-list">
<li className="footer__FirstChild-nav-item">
<Link
to="https://github.com/nazar-medushevskyi?tab=repositories"
className="footer__FirstChild-nav-link"
>
Github
</Link>
</li>
<li className="footer__FirstChild-nav-item">
<Link
to="/contacts"
className={`footer__FirstChild-nav-link ${location.pathname === '/contacts' ? 'is-activee' : ''}`}
>
Contacts
</Link>
</li>
<li className="footer__FirstChild-nav-item">
<Link
to="/rights"
className={`footer__FirstChild-nav-link ${location.pathname === '/rights' ? 'is-activee' : ''}`}
>
rights
</Link>
</li>
</ul>
</nav>
</div>

<div className="footer__ThridChild">
<p className="footer-p">Back to top</p>
<div className="footer__LastChild-arrow">

<button
type="button"
className="arrow-button"
onClick={handleScrollToTop}
>
<img
className="arrow-svg"
src={ArrowImage}
alt="basket"
/>
</button>

</div>
</div>

</footer>
);
};
1 change: 1 addition & 0 deletions src/Components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Footer } from './Footer';
Loading
Loading