Skip to content

Commit

Permalink
feat: adding media-queries mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Héon committed Aug 7, 2024
1 parent 0b00a06 commit dd000e0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import "mixins/normalize";

@import "mixins/media-queries";

@import "vendors/toastify.css";

@import "animations";
Expand Down
42 changes: 42 additions & 0 deletions frontend/src/styles/mixins/_media-queries.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* ============================================
= Media queries =
Use these mixins like this:
.example-class{
display: flex;
flex-direction: row;
@include xs{
flex-direction: column;
}
}
============================================ */

@mixin xs {
@media (min-width: map-get($media, xs)) {
@content;
}
}

@mixin sm {
@media (min-width: map-get($media, sm)) {
@content;
}
}

@mixin md {
@media (min-width: map-get($media, md)) {
@content;
}
}

@mixin lg {
@media (min-width: map-get($media, lg)) {
@content;
}
}

@mixin xl {
@media (min-width: map-get($media, xl)) {
@content;
}
}
2 changes: 1 addition & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default ({ mode }: { mode: string }) => {
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "./src/styles/_variables.scss";`,
additionalData: `@import "./src/styles/_variables.scss"; @import "./src/styles/mixins/_media-queries.scss";`,
},
},
},
Expand Down

0 comments on commit dd000e0

Please sign in to comment.