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

Os 001 #139

Open
wants to merge 3 commits into
base: main
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "online-store",
"name": "online-store-1",
"version": "1.0.0",
"description": "# ДЗ",
"main": "gulpfile.js",
Expand Down
9 changes: 8 additions & 1 deletion src/components/card/02-js-task/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Card component</title>
Expand All @@ -17,7 +18,8 @@
<div id="root" class="wrapper"></div>

<script type="module">
import Card from './solution/index.js';
import Card from './index.js';
// import Card from '../example/index.js';

const product = {
"id": "76w0hz7015kkr9kjkav",
Expand All @@ -35,6 +37,11 @@
const card = new Card(product);

root.append(card.element);




</script>
</body>

</html>
45 changes: 45 additions & 0 deletions src/components/card/02-js-task/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
export default class Card {
constructor(product) {
console.log('card', product.title);
this.componentProduct = product;
this.myRender();

}
getTemplate() {
return `
<div class="os-product-card">
<div
class="os-product-img"
style="
background-image: url(https://content2.rozetka.com.ua/goods/images/big_tile/163399632.jpg);
"
></div>

<div class="os-product-content">
<div class="os-product-price-wrapper">
<div class="os-product-rating">
<span>2.89</span>
<i class="bi bi-star">&nbsp;</i>
</div>

<div class="os-product-price">${product.price}</div>
</div>

<h5 class="os-product-title">
Acer Aspire 3 A315-57G-336G (NX.HZREU.01S) Charcoal Black
</h5>
<p class="os-product-description">laptops</p>
</div>

<footer class="os-product-footer">
<button class="os-btn-primary" data-element="addToCartBtn">
Add To Cart
</button>
</footer>
</div>
`;
}
myRender() {
const element = document.createElement('div');
element.className = 'os-product-card';
element.innerHTML = this.getTemplate();

}
}