Добавили обработчик событий по клику на карточку товара, создали компонент Header, установили библиотеку react-icons

This commit is contained in:
isHardCoded
2025-06-16 12:48:23 +03:00
parent 9367009fdf
commit 2ba1a63832
4 changed files with 35 additions and 4 deletions
+11 -1
View File
@@ -9,7 +9,8 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0" "react-dom": "^19.1.0",
"react-icons": "^5.5.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.25.0", "@eslint/js": "^9.25.0",
@@ -2461,6 +2462,15 @@
"react": "^19.1.0" "react": "^19.1.0"
} }
}, },
"node_modules/react-icons": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz",
"integrity": "sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==",
"license": "MIT",
"peerDependencies": {
"react": "*"
}
},
"node_modules/react-refresh": { "node_modules/react-refresh": {
"version": "0.17.0", "version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
+3 -2
View File
@@ -4,14 +4,15 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"lint": "eslint .", "lint": "eslint .",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0" "react-dom": "^19.1.0",
"react-icons": "^5.5.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.25.0", "@eslint/js": "^9.25.0",
+16 -1
View File
@@ -1,14 +1,26 @@
import styles from './App.module.css' import styles from './App.module.css'
import SneakersImage from './assets/images/sneakers-image.jpg' import SneakersImage from './assets/images/sneakers-image.jpg'
function Header() {
return (
<header className={styles.header}>
<h2>Logo</h2>
</header>
)
}
function Product() { function Product() {
function handleClick() {
console.log('Working!')
}
return ( return (
<div className={styles.product}> <div className={styles.product}>
<img src={SneakersImage} alt='' /> <img src={SneakersImage} alt='' />
<div className={styles.content}> <div className={styles.content}>
<div className={styles.title}> <div className={styles.title}>
<h4>Sneakers Red & White 2025</h4> <h4>Sneakers Red & White 2025</h4>
<button>+</button> <button onClick={event => handleClick(event)}>+</button>
</div> </div>
<p className={styles.description}>NIKE</p> <p className={styles.description}>NIKE</p>
<p className={styles.price}>$38.00</p> <p className={styles.price}>$38.00</p>
@@ -20,6 +32,9 @@ function Product() {
function App() { function App() {
return ( return (
<> <>
<div className={styles.container}>
<Header />
</div>
<div className={styles.container}> <div className={styles.container}>
<ul className={styles.list}> <ul className={styles.list}>
<li> <li>
+5
View File
@@ -1,3 +1,7 @@
.header {
display: flex;
}
.container { .container {
max-width: 1220px; max-width: 1220px;
margin: 0 auto; margin: 0 auto;
@@ -6,6 +10,7 @@
.list { .list {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap;
border-radius: 10px; border-radius: 10px;
margin-top: 100px; /* временно */ margin-top: 100px; /* временно */
padding: 20px; padding: 20px;