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

Site by GTXtab #488

Open
wants to merge 2 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
extends: [
'@mate-academy/eslint-config-react-typescript',
'plugin:cypress/recommended',
"prettier",
],
rules: {},
};
19 changes: 17 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@
"tabWidth": 2,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 80,
"printWidth": 100,
"semi": true,
"bracketSpacing": true,
"bracketSameLine": false
"bracketSameLine": false,

"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
"editor.fontSize": 15,
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"editor.detectIndentation": false,

"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.fixAll.eslint": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnType": true,
"editor.formatOnSave": true
}
307 changes: 137 additions & 170 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 25 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,36 @@
"classnames": "^2.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"react-router-dom": "^6.26.1",
"react-scripts": "5.0.1",
"react-transition-group": "^4.4.5"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@mate-academy/eslint-config-react-typescript": "latest",
"@mate-academy/scripts": "^1.7.9",
"@mate-academy/scripts": "^1.9.3",
"@mate-academy/students-ts-config": "latest",
"@mate-academy/stylelint-config": "latest",
"@types/node": "^16.18.80",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"cypress": "^12.17.4",
"eslint": "^7.32.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-prettier": "^5.2.1",
"gh-pages": "^6.1.1",
"husky": "^9.1.4",
"mochawesome": "^7.1.3",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^6.2.0",
"postcss": "^8.4.12",
"prettier": "^3.2.5",
"sass": "^1.72.0",
"prettier": "^3.3.3",
"sass": "^1.77.8",
"sass-loader": "^16.0.1",
"stylelint": "^15.11.0",
"typescript": "5.1.6"
"typescript": "5.1.6",
"webpack": "^5.93.0"
},
"scripts": {
"start": "mate-scripts start -l",
Expand Down Expand Up @@ -72,5 +77,20 @@
"_comment": "Add `cypressComponents: true` to enable component tests",
"cypress": true
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.ts": [
"eslint --fix",
"prettier --write"
],
"*.tsx": [
"eslint --fix",
"prettier --write"
]
}
}
Binary file added public/img/icons/Chevron (Arrow Down).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 public/img/icons/Chevron (Arrow Left).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 public/img/icons/Chevron (Arrow Right).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 public/img/icons/Chevron (Arrow Up).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 public/img/icons/Close.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 public/img/icons/Favourites (Heart Like).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 public/img/icons/Favourites Filled (Heart Like).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 public/img/icons/Home.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 public/img/icons/Logo.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 public/img/icons/Menu.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 public/img/icons/Minus.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 public/img/icons/Plus.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 public/img/icons/Search.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 public/img/icons/Shopping bag (Cart).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 public/img/icons/Shopping bag + Counter(Cart).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
// not empty
@import '/src/styles/fonts/fonts';
@import './styles/typography';
@import './styles/utils';

* {
font-family: $f-main;
box-sizing: border-box;
}
5 changes: 4 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import './App.scss';
import { Header } from './components/Header/Header';

export const App = () => (
<div className="App">
<h1>Product Catalog</h1>
<div className="container">
<Header />
</div>
</div>
);
19 changes: 19 additions & 0 deletions src/components/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.header {
display: flex;

&__logo {
width: 64px;
height: 22px;
}
}

.nav-bar {
display: flex;
gap: 10px;
&__link {
color: black;
text-transform: uppercase;
text-decoration: none;
font-size: 12px;
}
}
27 changes: 27 additions & 0 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Link, NavLink } from 'react-router-dom';
import './Header.scss';

export const Header: React.FC = () => {
return (
<header className="header">
<Link to="/">
<img src="./img/icons/Logo.png" alt="Nice gadgets" className="header__logo" />
</Link>
<nav className="nav-bar">
<NavLink to="/home" className="nav-bar__link">
Home
</NavLink>
<NavLink to="/home" className="nav-bar__link">
Phones
</NavLink>
<NavLink to="/home" className="nav-bar__link">
tablets
</NavLink>
<NavLink to="/home" className="nav-bar__link">
accessories
</NavLink>
</nav>
<h1>HELLO</h1>
</header>
);
};
15 changes: 14 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
import { createRoot } from 'react-dom/client';
import { App } from './App';
import { HashRouter, Navigate, Route, Routes } from 'react-router-dom';
import { PageNotFound } from './pages/PageNotFound';
import { HomePage } from './pages/HomePage';

createRoot(document.getElementById('root') as HTMLElement).render(<App />);
createRoot(document.getElementById('root') as HTMLElement).render(
<HashRouter>
<Routes>
<Route path="/" element={<App />}>
<Route path="/home" element={<Navigate to="/" />} />
<Route index element={<HomePage />} />
<Route path="*" element={<PageNotFound />} />
</Route>
</Routes>
</HashRouter>,
);
3 changes: 3 additions & 0 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const HomePage: React.FC = () => {
return <h1 className="title">Hello world</h1>;
};
3 changes: 3 additions & 0 deletions src/pages/PageNotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const PageNotFound: React.FC = () => {
return <h1 className="title">Page Not Found</h1>;
};
100 changes: 100 additions & 0 deletions src/styles/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@import './utils';

h1 {
font-weight: bold;
font-size: 32px;
line-height: 41px;
letter-spacing: -0.01em;
}

h2 {
font-weight: bold;
font-size: 22px;
line-height: 31px;
letter-spacing: 0;
}

h3 {
font-weight: 600;
font-size: 20px;
line-height: 26px;
letter-spacing: 0;
}

h4 {
font-weight: 600;
font-size: 16px;
line-height: 20px;
letter-spacing: 0;
}

h5 {
font-size: 12px;
line-height: 15px;
letter-spacing: 0;
}

h6 {
font-size: 12px;
line-height: 11px;
letter-spacing: 0.04em;
}

button {
font-size: 14px;
line-height: 21px;
}

p {
font-size: 14px;
line-height: 21px;
font-weight: normal;
}


@include on-tablet {
h1 {
font-size: 48px;
line-height: 56px;
letter-spacing: -0.01em;
}

h2 {
font-size: 32px;
line-height: 41px;
letter-spacing: -0.01em;
}

h3 {
font-size: 22px;
line-height: 31px;
letter-spacing: 0;
}

h4 {
font-size: 20px;
line-height: 26px;
letter-spacing: 0;
}

h5 {
font-size: 12px;
line-height: 15px;
letter-spacing: 0;
}

h6 {
font-size: 12px;
line-height: 11px;
letter-spacing: 0.04em;
}

button {
font-size: 14px;
line-height: 21px;
}

p {
font-weight: normal;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions src/styles/fonts/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@font-face {
font-family: Mont;
src: url("../fonts/Mont-Regular.otf") format("opentype");
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: Mont;
src: url("../fonts/Mont-Regular.otf") format("opentype");
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: Mont;
src: url("../fonts/Mont-SemiBold.otf") format("opentype");
font-weight: 600;
font-style: normal;
}
2 changes: 2 additions & 0 deletions src/styles/utils.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './utils/vars';
@import './utils/mixins';
43 changes: 43 additions & 0 deletions src/styles/utils/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@mixin hover($_property, $_toValue) {
transition: #{$_property} 0.3s;
&:hover {
#{$_property}: $_toValue;
}
}

@mixin on-tablet {
@media (min-width: $width-tablet) {
@content;
}
}

@mixin on-laptop {
@media (min-width: $width-laptop) {
@content;
}
}

@mixin on-desktop {
@media (min-width: $width-desktop) {
@content;
}
}

@mixin container {
padding-inline: 16px;
@content;

@include on-tablet {
padding-inline: 24px;
}

@include on-desktop {
padding-inline: 32px;
}
}

@mixin template {
display: grid;
align-items: center;
@content;
}
17 changes: 17 additions & 0 deletions src/styles/utils/_vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Colors

$c-primary: #313237;
$c-secondary: #89939A;
$c-icon: #B4BDC4;
$c-element: #E2E6E9;
$c-hover-bg: #FAFBFC;
$c-white: #FFF;
$c-green: #27AE60;
$c-red: #EB5757;

// Screen-widths

$width-tablet: 640px;
$width-laptop: 1280px;
$width-desktop: 1440px;
$f-main: 'Mont';
Loading