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

added card #5142

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
51 changes: 50 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,61 @@
content="width=device-width, initial-scale=1.0"
/>
<title>Product cards</title>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crossorigin attribute is missing for the Google Fonts link. Add crossorigin="anonymous" to ensure proper font loading.

/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
src="/src/images/imac.jpeg"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image path should be relative to ensure it works correctly in different environments. Please change /src/images/imac.jpeg to a relative path like ./images/imac.jpeg.

class="card__image"
alt="Imac"
/>
<a
href="#"
class="card__title link"
>
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</a>
<div class="card__product-code">Product code: 195434</div>
<div class="card__rating">
<div class="card__stars">
<div class="card__star"></div>
<div class="card__star"></div>
<div class="card__star"></div>
<div class="card__star"></div>
<div class="card__star"></div>
</div>
<div class="card__reviews">Reviews: 5</div>
</div>
<div class="card__price">
<div class="card__price-title">Price:</div>
<div class="card__price-value">$2,199</div>
</div>
<a
href="#"
class="card__button link"
data-qa="hover"
>
BUY
</a>
</div>
</body>
</html>
101 changes: 101 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
@import '/src/styles/variables';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path for the SCSS variables should be relative. Change '/src/styles/variables' to './variables'.

@import '/src/styles/stars';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path for the SCSS stars should be relative. Change '/src/styles/stars' to './stars'.


body {
margin: 0;
font-family: Roboto, serif;
font-weight: 400;
color: $primary-color;
}

.link {
text-decoration: none;
color: $primary-color;
}

.card {
box-sizing: border-box;
max-width: 200px;
border: 1px solid #f3f3f3;
border-radius: 5px;
background: #fff;

padding: 32px 16px 16px;

display: flex;
flex-direction: column;

&__image {
display: block;
margin: 0 auto 40px;
width: 160px;
height: 134px;
}

&__title {
margin: 0 0 4px;
font-size: 12px;
line-height: 18px;
font-weight: 500;
}

&__product-code {
color: $secondary-color;
font-size: 10px;
line-height: 14px;

margin-bottom: 16px;
}

&__rating {
display: flex;
justify-content: space-between;
align-items: flex-end;

margin-bottom: 24px;
}

&__reviews {
font-size: 10px;
line-height: 14px;
}

&__price {
display: flex;
justify-content: space-between;
align-items: center;

margin-bottom: 16px;
}

&__price-title {
color: $secondary-color;
font-size: 12px;
line-height: 18px;
}

&__price-value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
}

&__button {
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
height: 40px;
border-radius: 5px;
background-color: #00acdc;
font-size: 14px;
line-height: 16px;
color: #fff;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
}

&__button:hover {
background-color: #fff;
border: 1px solid #00acdc;
color: #00acdc;
}
}
18 changes: 18 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.card {
&__stars {
display: flex;
gap: 4px;
}

&__star {
width: 16px;
height: 16px;
background-image: url(/src/images/star.svg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image path should be relative to ensure it works correctly in different environments. Please change /src/images/star.svg to a relative path like ../images/star.svg.

background-position: center;
background-repeat: no-repeat;
}

&__star:nth-child(-n + 4) {
background-image: url(/src/images/star-active.svg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image path should be relative to ensure it works correctly in different environments. Please change /src/images/star-active.svg to a relative path like ../images/star-active.svg.

}
}
2 changes: 2 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$primary-color: #060b35;
$secondary-color: #616070;
Loading