Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
34 changes: 31 additions & 3 deletions src/styles/_catalog.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
$breakpoint-computer: 1024px;
$breakpoint-tablet: 768px;
$breakpoint-phone: 488px;

.catalog {
display: flex;
flex-wrap: wrap;
display: grid;
gap: 48px;

max-width: 944px;
margin: 0 auto;

&__card {
display: flex;
display: grid;
justify-content: center;
align-items: center;
width: 200px;
Expand All @@ -20,3 +24,27 @@
margin-right: 48px;
}
}

@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);
}
}

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