Skip to content

Commit

Permalink
got project working
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislockwoodfl committed Dec 23, 2024
1 parent 606dc21 commit a021761
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 7 deletions.
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs

❗️ Replace `<your_account>` with your GitHub username and copy the links to the `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_product-cards/report/html_report/)
- [DEMO LINK](https://chrislockwoodfl.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://chrislockwoodfl.github.io/layout_product-cards/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

- [ ] there 2 BEM blocks `card` and `stars` each in their own file
- [ ] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes`
- [ ] SCSS Variables are used for main values and placed in a **separate file**
- [ ] all `stars--N` modifiers work as expected (Highlight first `N` stars)
- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
- [x] there 2 BEM blocks `card` and `stars` each in their own file
- [x] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes`
- [x] SCSS Variables are used for main values and placed in a **separate file**
- [x] all `stars--N` modifiers work as expected (Highlight first `N` stars)
- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
41 changes: 41 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,49 @@
rel="stylesheet"
href="./styles/index.scss"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
/>
</head>

<body>
<h1>Product cards</h1>
<div
class="card"
id="card"
data-qa="card"
>
<div class="product-image"></div>
<div class="product-name">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="product-code">Product code: 195434</div>

<div class="reviews-box">
<div class="stars">
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star-off"></div>
</div>
<div class="reviews">Reviews: 5</div>
</div>

<div class="price-box">
<span class="price-label">Price:</span>
<span class="price">$2,199</span>
</div>

<div class="buy-box">
<a
data-qa="hover"
class="buy-link"
>
BUY
</a>
</div>
</div>
</body>
</html>
6 changes: 6 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.card {
width: 198px;
border: 1px solid #f3f3f3;
border-radius: 5px;
margin: auto; /* center card horizontally and vertically */
}
118 changes: 118 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,121 @@
@use 'stars';
@use 'card';

$light-text: #616070;
$dark-text: #060b35;
$button-color: #00acdc;

body {
margin: 0;
font-family: Roboto, sans-serif;
font-size: 12px;
color: $dark-text;
}

.product-image {
width: 160px;
height: 134px;
background-size: 160px 134px;
background-image: url('../images/imac.jpeg');
background-position: center;
margin-top: 32.5px;
margin-left: auto;
margin-right: auto;
}

.product-name {
margin-top: 40px;
padding-left: 16px;
padding-right: 15px;
font-weight: 500;
line-height: 18px;
color: $dark-text;
}

.product-code {
font-weight: 400;
font-size: 10px;
color: $light-text;
line-height: 14px;
padding-top: 4px;
padding-left: 16px;
}

.reviews-box {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
padding-top: 16px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 0;
}

.flex-container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}

.reviews {
font-weight: 400;
font-size: 10px;
padding-top: 3px;
}

.price-box {
margin-top: 0;
margin-bottom: 0;
display: flex;
justify-content: space-between;
align-items: center;
padding: 24px 16px 15px;
}

.price-label {
font-weight: 400;
font-size: 12px;
color: $light-text;
line-height: 18px;
padding-top: 0;
}

.price {
font-weight: 900;
font-size: 16px;
line-height: 18px;
color: black;
}

.buy-box {
width: 166px;
height: 40px;
background-color: $button-color;
color: white;
font-weight: 1000;
font-size: 14px;
line-height: 16px;
border-radius: 5px;
display: flex;
align-items: center;
margin-top: 1px;
margin-left: auto;
margin-right: auto;
padding-top: 0;
}

.buy-box:hover {
background-color: white;
color: $button-color;
border: 1px solid $button-color;
width: 164px;
height: 38px;
font-weight: 1000;
line-height: 16px;
}

.buy-link {
margin: 0 auto;
}
24 changes: 24 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.stars {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}

.star {
width: 16px;
height: 16px;
background-position: center;
background-repeat: no-repeat;
background-image: url('../images/star-active.svg');
margin-right: 4px;
}

.star-off {
width: 16px;
height: 16px;
background-position: center;
background-repeat: no-repeat;
background-image: url('../images/star.svg');
margin-right: 4px;
}
3 changes: 3 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$light-text: #616070;
$dark-text: #060b35;
$button-color: #00acdc;

0 comments on commit a021761

Please sign in to comment.