From 61abe783eb15071ddff8bd11d817fd0d7c2d49ef Mon Sep 17 00:00:00 2001 From: Mivinci <1366723936@qq.com> Date: Fri, 5 May 2023 10:40:45 +0800 Subject: [PATCH] add an breakpoint at screen width equal to 640px --- assets/css/atom.scss | 71 +++++++++++++++++------------------- layouts/partials/footer.html | 2 +- layouts/partials/item.html | 2 +- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/assets/css/atom.scss b/assets/css/atom.scss index 297a669..0e3f786 100644 --- a/assets/css/atom.scss +++ b/assets/css/atom.scss @@ -1,7 +1,37 @@ -// $devices: ("", 0), (sm\:, 480px); -// @each $dev, $size in devices { -// // this is gonna waste hella space -// } +@mixin breakpoint($k, $v) { + @if $k == "" { + @content; + } + @else { + @media (min-width: $v) { + @content; + } + } +} + +/* flex */ +$screens: ("", 0), (sm\:, 640px); +@each $k, $v in $screens { + @include breakpoint($k, $v) { + .#{$k}flex { display: flex; } + + .#{$k}flex-row { flex-direction: row; } + + .#{$k}flex-col { flex-direction: column; } + + .#{$k}flex-col-reverse { flex-direction: column-reverse; } + + .#{$k}justify-between { justify-content: space-between; } + + .#{$k}items-center { align-items: center; } + + .#{$k}items-start { align-items: flex-start; } + + .#{$k}items-end { align-items: flex-end; } + + .#{$k}items-baseline { align-items: baseline; } + } +} /* layout */ .container { @@ -20,39 +50,6 @@ overflow-y: hidden; } -/* flex & grid */ -.flex { - display: flex; -} - -.flex-row { - flex-direction: row; -} - -.flex-column { - flex-direction: column; -} - -.justify-between { - justify-content: space-between; -} - -.items-center { - align-items: center; -} - -.items-start { - align-items: flex-start; -} - -.items-end { - align-items: flex-end; -} - -.items-baseline { - align-items: baseline; -} - /* spacing */ $u: 0.25; @each $i, $class in (p, padding), (m, margin) { diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index bce8361..bf7ad67 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,6 +1,6 @@