forked from HackYourFuture/React
-
Notifications
You must be signed in to change notification settings - Fork 10
Volodymyr-react-w2 #11
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
Open
Volodymyr-coder
wants to merge
18
commits into
HackYourAssignment:main
Choose a base branch
from
Volodymyr-coder:Volodymyr-react-w2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2c3fbb8
assignment
Volodymyr-coder c51c1a2
link to App - jovial-nougat-94c98a.netlify.app
Volodymyr-coder 068a69c
add routes
Volodymyr-coder b9a6b2f
home page with render all product
Volodymyr-coder 90f6bde
fetch category
Volodymyr-coder ab0be9e
product category
Volodymyr-coder 8c21b11
.
Volodymyr-coder 811ee9e
render one product
Volodymyr-coder 4f59105
css
Volodymyr-coder 7b33aeb
Add Netlify config
Volodymyr-coder 76801aa
config + netify
Volodymyr-coder db11c50
.
Volodymyr-coder 18b1181
.,
Volodymyr-coder f9c9bfa
.
Volodymyr-coder 9a80322
,
Volodymyr-coder 57a3e62
C:/Program Files/Git/
Volodymyr-coder 5fb70f4
deploy
Volodymyr-coder dbce44d
link
Volodymyr-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# React + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
||
## Expanding the ESLint configuration | ||
|
||
If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project. | ||
|
||
<!-- link to my App: jovial-nougat-94c98a.netlify.app --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useState } from 'react'; | ||
import Category from './Category.jsx'; | ||
import allCategories from '../src/fake-data/all-categories.js'; | ||
import products from '../src/fake-data/all-products.js'; | ||
import css from './Categories.module.css'; | ||
|
||
const Categories = () => { | ||
const [filtered, setFiltered] = useState(products); | ||
|
||
const handlerProduct = (category) => { | ||
const cleanCategory = category.replace(/^FAKE:\s*/, ''); | ||
const filteredArr = products.filter((product) => { | ||
return product.category === cleanCategory; | ||
}); | ||
setFiltered(filteredArr); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Category arr={allCategories} onClick={handlerProduct} /> | ||
<ul className={css.gridContainer}> | ||
{filtered.map((product) => ( | ||
<li className={css.item} key={product.id}> | ||
<img className={css.img} src={product.image} alt={product.title} /> | ||
<p className={css.title}>{product.title}</p> | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
); | ||
}; | ||
|
||
export default Categories; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.gridContainer { | ||
display: grid; | ||
gap: 1rem; | ||
grid-template-columns: 1fr; | ||
} | ||
|
||
@media (min-width: 600px) { | ||
.gridContainer { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
} | ||
|
||
@media (min-width: 1000px) { | ||
.gridContainer { | ||
grid-template-columns: repeat(3, 1fr); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import css from './Category.module.css'; | ||
|
||
const Category = ({ arr, onClick }) => { | ||
return ( | ||
<div className={css.container}> | ||
{arr.map((category) => { | ||
return ( | ||
<> | ||
<button | ||
className={css.button} | ||
key={category.index} | ||
onClick={() => onClick(category)} | ||
> | ||
{category} | ||
</button> | ||
</> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Category; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.container { | ||
display: flex; | ||
gap: 5px; | ||
} | ||
|
||
/* | ||
.button { | ||
background-color: lightgray; | ||
} | ||
|
||
.button.hover { | ||
background-color: darkgray; | ||
} */ | ||
|
||
.button { | ||
background-color: lightgray; | ||
color: black; | ||
transition: 0.3s ease; | ||
} | ||
|
||
.button:hover { | ||
background-color: darkgray; | ||
color: white; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import Categories from './Categories'; | ||
|
||
const Products = () => { | ||
return ( | ||
<div> | ||
<Categories /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Products; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
|
||
export default [ | ||
{ ignores: ['dist'] }, | ||
{ | ||
files: ['**/*.{js,jsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
ecmaFeatures: { jsx: true }, | ||
sourceType: 'module', | ||
}, | ||
}, | ||
plugins: { | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
...reactHooks.configs.recommended.rules, | ||
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}, | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: please remove week1 files from this commit (but not from the project itself)