Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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 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://steveforde.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
45 changes: 31 additions & 14 deletions src/styles/_catalog.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
.catalog {
display: flex;
flex-wrap: wrap;

display: grid;
grid-gap: 48px;
max-width: 944px;
margin: 0 auto;
justify-content: center;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
justify-content: center;
justify-items: center;

align-items: center;

@media (min-width: 1024px) {
grid-template-columns: repeat(4, 1fr);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here is the reason. Create a variable for the card width and use it
$card-width: 200px;

Suggested change
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(4, $card-width);

}

@media (min-width: 768px) and (max-width: 1023px) {
grid-template-columns: repeat(3, 1fr);
}

&__card {
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 300px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 48px;
@media (min-width: 488px) and (max-width: 767px) {
grid-template-columns: repeat(2, 1fr);
}

&__card:not(:nth-child(4n)) {
margin-right: 48px;
@media (max-width: 487px) {
grid-template-columns: repeat(1, 1fr);
}
}

.catalog__card {
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 300px;
border: 1px solid #ccc;
border-radius: 5px;
}

.catalog__card:nth-child(3n + 1),
.catalog__card:nth-child(3n + 2),
.catalog__card:nth-child(3n + 3) {
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This code seems redundant