Skip to content

Commit

Permalink
Define breakpoints and font sizes (#198)
Browse files Browse the repository at this point in the history
https://www.refactoringui.com strongly recommends using a design system
where we systematize colors, font sizes, and breakpoints. That is all
moved to a new `theme/` folder. This will be useful with the mandates
map, that we can keep in sync the same files.

The breakpoint sizes come from tailwind.css.

The font scale comes from refactoringui.com. It strongly recommends
using `px` over `em`, and generally `px` over `rem` but `em` is an
issue.
  • Loading branch information
Eric-Arellano authored Jul 2, 2024
1 parent b615136 commit e917bf6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/css/_about.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "colors";
@use "theme/colors";

dd {
margin-bottom: 10px;
Expand Down
2 changes: 1 addition & 1 deletion src/css/_header.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "colors";
@use "theme/colors";

header {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/css/_scorecard.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "colors";
@use "theme/colors";

.popup-fixed {
position: fixed;
Expand Down
30 changes: 30 additions & 0 deletions src/css/theme/_breakpoints.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Inspired by https://dev.to/alberto/defining-responsive-breakpoints-made-easy-with-sass-mixins-26p0.

$sm-width: "640px";
$md-width: "768px";
$lg-width: "1024px";
$xl-width: "1280px";

@mixin gt-xs() {
@media screen and (min-width: $sm-width) {
@content();
}
}

@mixin gt-sm() {
@media screen and (min-width: $md-width) {
@content();
}
}

@mixin gt-md() {
@media screen and (min-width: $lg-width) {
@content();
}
}

@mixin gt-lg() {
@media screen and (min-width: $xl-width) {
@content();
}
}
File renamed without changes.
7 changes: 7 additions & 0 deletions src/css/theme/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$font-size-xs: 12px;
$font-size-sm: 14px;
$font-size-base: 16px;
$font-size-md: 18px;
$font-size-lg: 20px;
$font-size-xl: 24px;
$font-size-2xl: 30px;

0 comments on commit e917bf6

Please sign in to comment.