I would like to know what would be the best practice to use different grid sizes with the same block.
Ex:
- I have a Card component, and on my dashboard page I wish to have 4 Card s per line
- I also use this component elsewhere, on the users page, I want to display 2 cards per line
In case I would have:
// dashboard.html
| Card1 | Card2 | Card3 | Card4 |
| Card5 | Card6 | Card7 | Card8 |
// users.html
| Card1 | Card2 |
| Card3 | Card4 |
// Estrutura
<div class="Card">
<div class="Card__title">
Meu titulo
</div>
<div class="Card__content">
Meu conteúdo
</div>
</div>
I thought of the following options:
// Card.scss
.Card {
border: solid 1px black;
}
.Card__title {
display: block;
border-bottom: solid 1px black;
}
// Dash-cardgrid.scss .Dash-cardgrid { > .Card { lost-column: 1/4; } } // User-cardgrid.scss .User-cardgrid { > .Card { lost-column: 1/2; } }
// Dash-card.scss .Dash-card{ @extend .Card; lost-column: 1/4; } // User-card.scss .User-card{ @extend .Card; lost-column: 1/2; }
// Card.scss .Card { ... &--four-by-row { lost-column: 1/4; } &--two-by-row { lost-column: 1/2; } } ...
// utils.scss .utils { ... &--four-by-row { lost-column: 1/4; } &--two-by-row { lost-column: 1/2; } } ...