Skip to content
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"parcel": "^1.12.4",
"stylelint": "^13.5.0",
"stylelint-config-recommended-scss": "^3.3.0",
"stylelint-scss": "^3.17.2"
"stylelint-scss": "^3.17.2",
"sass": "^1.69.5"
},
"browserslist": [
"last 2 versions"
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Frontend practice with catalog page using grid
Replace `<your_account>` with your Github username and copy the links to Pull Request description:
- [DEMO LINK](https://<your_account>.github.io/layout_catalog_grid/)
- [DEMO LINK](https://anton-chornobai.github.io/layout_catalog_grid/)

> Follow [this instructions](https://github.com/mate-academy/layout_task-guideline#how-to-solve-the-layout-tasks-on-github)

Expand Down
36 changes: 31 additions & 5 deletions src/styles/_catalog.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.catalog {
display: flex;
flex-wrap: wrap;
$breakpoint-computer: 1024px;
$breakpoint-tablet: 768px;
$breakpoint-phone: 488px;

.catalog {
display: grid;
gap: 48px;
max-width: 944px;
margin: 0 auto;
padding: 0 20px;


&__card {
display: flex;
Expand All @@ -14,9 +19,30 @@
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 48px;
box-sizing: border-box;
}
}

@media (min-width: $breakpoint-phone) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we have two variants how to use @media. Either selector inside media or media inside selector.
But usually we use second variant
Example:

.selector {
  @media (...) {
    ...
  }
  
  @media (...) {
    ...
  }
 
  ....
}

.catalog {
grid-template-columns: repeat(2, 1fr);
}
}

@media (max-width: $breakpoint-phone) {
.catalog {
grid-template-columns: repeat(1, 1fr);
}
}

@media (min-width: $breakpoint-tablet) {
.catalog {
grid-template-columns: repeat(3, 1fr);
}
}

&__card:not(:nth-child(4n)) {
margin-right: 48px;
@media (min-width: $breakpoint-computer) {
.catalog {
grid-template-columns: repeat(4, 1fr);
}
}