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
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://kyrylomanko.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
18 changes: 9 additions & 9 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@
</head>
<body>
<header class="header">
<a class="header__logo" href="">
<a class="header__logo" href="#">
<img src="./images/logo.png" alt="Moyo logo">
</a>

<nav class="nav">
<ul class="nav__list">
<li class="nav__item nav__item--is-active">
<a href="" class="nav__link">Apple</a>
<a href="#" class="nav__link">Apple</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Samsung</a>
<a href="#" class="nav__link">Samsung</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Smartphones</a>
<a href="#" class="nav__link">Smartphones</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Laptops & computers</a>
<a href="#" class="nav__link">Laptops & computers</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Gadgets</a>
<a href="#" class="nav__link">Gadgets</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Tablets</a>
<a href="#" class="nav__link">Tablets</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Photo</a>
<a href="#" class="nav__link">Photo</a>
</li>
<li class="nav__item">
<a href="" class="nav__link">Video</a>
<a href="#" class="nav__link">Video</a>
</li>
</ul>
</nav>
Expand Down
22 changes: 0 additions & 22 deletions src/styles/_catalog.scss

This file was deleted.

41 changes: 41 additions & 0 deletions src/styles/blocks/_catalog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.catalog {
display: grid;
grid-template-columns: repeat(auto-fill, 200px);
justify-content: center;
gap: 48px;

max-width: 944px;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You don't need to add a max width here. Just use the grid template

margin: 0 auto;

&__card {
display: flex;
justify-content: center;
align-items: center;
width: $card-width;
height: 300px;
border: 1px solid #ccc;
border-radius: 5px;
}

&__card:not(:nth-child(4n)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove unnecessary margin-right style for cards since the gap property in the grid layout is already handling the space between cards.

margin-right: 48px;
}
}

@media (max-width: 1023) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use correct breakpoints for the media queries. Check all breakpoints, please
image

image

.catalog {
grid-template-columns: repeat(3, $card-width);
}
}

@media (max-width: 767) {
.catalog {
grid-template-columns: repeat(2, $card-width);
}
}

@media (max-width: 487) {
.catalog {
grid-template-columns: repeat(1, $card-width);
}
}
File renamed without changes.
8 changes: 5 additions & 3 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@import "./utils/variables";

@import "./blocks/header";
@import "./blocks/catalog";

html {
font-family: Roboto, sans-serif;
}
Expand All @@ -9,6 +14,3 @@ body {
* {
box-sizing: border-box;
}

@import "_header.scss";
@import "_catalog.scss";
1 change: 1 addition & 0 deletions src/styles/utils/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$card-width: 200px;