[UI] Extracted grid into layout.scss.

This commit is contained in:
Fabio Manganiello 2023-11-09 01:35:49 +01:00
parent 4814c56a2d
commit a83f4729a6
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 32 additions and 29 deletions

View file

@ -5,7 +5,7 @@
No search results No search results
</NoItems> </NoItems>
<div class="media-grid" v-else> <div class="grid" v-else>
<Item v-for="(item, i) in results" <Item v-for="(item, i) in results"
:key="i" :key="i"
:item="item" :item="item"
@ -77,34 +77,6 @@ export default {
background: $background-color; background: $background-color;
overflow: auto; overflow: auto;
.media-grid {
width: 100%;
display: grid;
row-gap: 1em;
column-gap: 1.5em;
padding: 1em;
@include until($tablet) {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 640px) and (max-width: $tablet) {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@include between($tablet, $desktop) {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
@include between($desktop, $widescreen) {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
@include from($widescreen) {
grid-template-columns: repeat(5, minmax(0, 1fr));
}
}
.info-container { .info-container {
width: 100%; width: 100%;
cursor: initial; cursor: initial;

View file

@ -1,5 +1,6 @@
@use "sass:math"; @use "sass:math";
$tablet-small: 640px;
$tablet: 769px; $tablet: 769px;
$desktop: 1024px; $desktop: 1024px;
$widescreen: 1216px; $widescreen: 1216px;
@ -13,6 +14,7 @@ $widths: (
); );
$width-ranges: ( $width-ranges: (
tablet-small: ($tablet-small, $tablet),
tablet: ($tablet, $desktop), tablet: ($tablet, $desktop),
desktop: ($desktop, $widescreen), desktop: ($desktop, $widescreen),
widescreen: ($widescreen, $fullhd), widescreen: ($widescreen, $fullhd),
@ -227,3 +229,32 @@ $width-ranges: (
justify-content: center; justify-content: center;
} }
// Grid layout
.grid {
width: 100%;
display: grid;
row-gap: 1em;
column-gap: 1.5em;
padding: 1em;
@include until($tablet-small) {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
@include between($tablet-small, $tablet) {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@include between($tablet, $desktop) {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
@include between($desktop, $widescreen) {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
@include from($widescreen) {
grid-template-columns: repeat(5, minmax(0, 1fr));
}
}