Skip to content

Commit

Permalink
Refactor tokens and utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dostonnabotov committed Dec 7, 2023
1 parent bea93c0 commit 47396c7
Show file tree
Hide file tree
Showing 18 changed files with 289 additions and 356 deletions.
559 changes: 231 additions & 328 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions sass/abstracts/_tokens.scss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// layout
$container-max-width: 70rem;
$container-padding-x: 2rem;

$flow-space: 1em;
10 changes: 10 additions & 0 deletions sass/abstracts/_type.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// global tokens
$-ff-roboto: "Roboto", sans-serif;
$-ff-merriweather: "Merriweather", serif;

// variables & utils
$font-families: (
"primary": $-ff-roboto,
"secondary": $-ff-merriweather,
);

$font-sizes: (
"300": 0.875rem,
"400": 1rem,
Expand Down
8 changes: 7 additions & 1 deletion sass/base/_base.scss → sass/base/_global.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
@use "../abstracts" as *;

body {
font-family: system-ui;
font-family: var(--ff-primary);
background-color: var(--background-primary);
color: var(--text-primary);
}

h1,
h2,
h3 {
line-height: 1.1;
}
3 changes: 1 addition & 2 deletions sass/base/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@forward "root";
@forward "reset";
@forward "base";
@forward "typography";
@forward "global";
2 changes: 2 additions & 0 deletions sass/base/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ body {
line-height: 1.5;
}

// :where() is used to remove specificity,
// so that it doesn't interfere when styled with class.
ul:where([role="list"]),
ol:where([role="list"]) {
list-style: none;
Expand Down
4 changes: 4 additions & 0 deletions sass/base/_root.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@use "../abstracts" as *;

:root {
@each $key, $value in $font-families {
--ff-#{$key}: #{$value};
}

@each $key, $value in $font-sizes {
--fs-#{$key}: #{$value};
}
Expand Down
5 changes: 0 additions & 5 deletions sass/base/_typography.scss

This file was deleted.

4 changes: 0 additions & 4 deletions sass/layout/_flex.scss

This file was deleted.

4 changes: 0 additions & 4 deletions sass/layout/_grid.scss

This file was deleted.

6 changes: 6 additions & 0 deletions sass/layouts/_flex.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.flex-group {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem;
}
4 changes: 4 additions & 0 deletions sass/layouts/_grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.grid-flow {
display: grid;
gap: 1rem;
}
File renamed without changes.
2 changes: 1 addition & 1 deletion sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
@use "themes";
@use "base";
@use "components";
@use "layout";
@use "layouts";
@use "utilities";
18 changes: 9 additions & 9 deletions sass/themes/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
@use "../abstracts" as *;

:root {
@include light-theme;
// :root {
// @include light-theme;

@media (prefers-color-scheme: light) {
@include light-theme;
}
// @media (prefers-color-scheme: light) {
// @include light-theme;
// }

@media (prefers-color-scheme: dark) {
@include dark-theme;
}
}
// @media (prefers-color-scheme: dark) {
// @include dark-theme;
// }
// }

.light-theme {
@include light-theme;
Expand Down
6 changes: 4 additions & 2 deletions sass/utilities/_container.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use "../abstracts" as *;

.container {
width: 100%;
max-width: 70rem;
max-width: $container-max-width;
margin-inline: auto;
padding-inline: 2rem;
padding-inline: $container-padding-x;
}
5 changes: 5 additions & 0 deletions sass/utilities/_flow.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "../abstracts" as *;

.flow > *:where(:not(:first-child)) {
margin-top: $flow-space;
}
1 change: 1 addition & 0 deletions sass/utilities/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@forward "container";
@forward "flow";
@forward "sr-only";

0 comments on commit 47396c7

Please sign in to comment.