-
Notifications
You must be signed in to change notification settings - Fork 99
ДЗ_1 Java #3
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
base: master
Are you sure you want to change the base?
ДЗ_1 Java #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| *{ | ||
| margin: 0 auto; | ||
| padding: auto; | ||
|
|
||
| } | ||
| body{ | ||
| background-color: #dedaeedd; | ||
| } | ||
| header{ | ||
| display: grid; | ||
| grid-template-rows: 1fr; | ||
| justify-content: flex-end; | ||
| background-color: #cccc; | ||
| } | ||
| .btn-cart{ | ||
| padding: 10px 50px; | ||
| background-color: #fff; | ||
| } | ||
| main{ | ||
| display: grid; | ||
| grid-template-columns: 1fr; | ||
| } | ||
| .products{ | ||
| display: grid; | ||
| grid-template-columns: 1fr 1fr; | ||
| grid-template-rows: 1fr; | ||
| } | ||
| .product-item{ | ||
| border: 1px solid black; | ||
| display: block; | ||
| width: 350px; | ||
| height: 200px; | ||
| margin: 5px; | ||
| } | ||
| .product-item h3{ | ||
| color: red; | ||
| font-size: 30px; | ||
| margin: 5px; | ||
| } | ||
| .product-item p{ | ||
| font-weight: 600; | ||
| font-size: 18px; | ||
| margin-left: 10px; | ||
| } | ||
| button{ | ||
| margin: 5px; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <link rel="stylesheet" href="css/style.css"> | ||
| <title>Title</title> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <button class="btn-cart">Cart</button> | ||
| </header> | ||
| <main> | ||
| <div class="products"></div> | ||
| </main> | ||
| <script src="js/main.js"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| const data = [ | ||
| { title: 'Notebook', id: 1, price: 2000 }, | ||
| { title: 'Keyboard', id: 2, price: 200 }, | ||
| { title: 'Mouse', id: 3, price: 100 }, | ||
| { title: 'Gamepad', id: 4, price: 87 }, | ||
| { title: 'Новый Товар', id: 5 } | ||
| ]; | ||
| const renderProduct = (title, id, price = 'Цена товара', img = "https://placehold.it//150x100") => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. У вас опечатка в урле изображения, лишний слэш после .it - |
||
| return ` | ||
| <div class="product-item"> | ||
| <img src = "${img}" alt = "${title}"> | ||
| <div> | ||
| <h3>${title}</h3> | ||
| <p>${price}</p> | ||
| <button>Купить</button> | ||
| </div> | ||
| </div> | ||
| ` | ||
| }; | ||
|
|
||
| const render = (products) => { | ||
| document.querySelector('.products').innerHTML = products.map(item => renderProduct(item.title, item.id, item.price)).join(''); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. По 3-му заданию все выполнено верно |
||
| }; | ||
|
|
||
| render(data); | ||
| console.log(data) | ||
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.
Принимаю стили