Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helpers): introduce padding and margin helpers from Tailwind #1488

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions src/styles/isomer-template/helpers.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
These are margin and padding helpers with values that follow the ones
used by Tailwind CSS. This will generate several classes, such as:
- .mr-8 which gives margin-right 2rem
- .mx-16 which gives margin-left and margin-right 4rem
- .py-4 which gives padding-top and padding-bottom 1rem
- .p-20 which gives padding 5rem
*/

$spaceamounts: (
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
14,
16,
20,
24,
28,
32,
36,
40,
44,
48,
52,
56,
60,
64,
72,
80,
96
);
$sides: (top, bottom, left, right);

@each $space in $spaceamounts {
$remSpace: calc(#{$space}rem / 4);

@each $side in $sides {
.m#{str-slice($side, 0, 1)}-#{$space} {
margin-#{$side}: $remSpace;
}

.p#{str-slice($side, 0, 1)}-#{$space} {
padding-#{$side}: $remSpace;
}
}

.mx-#{$space} {
margin-left: $remSpace;
margin-right: $remSpace;
}

.px-#{$space} {
padding-left: $remSpace;
padding-right: $remSpace;
}

.my-#{$space} {
margin-top: $remSpace;
margin-bottom: $remSpace;
}

.py-#{$space} {
padding-top: $remSpace;
padding-bottom: $remSpace;
}

.m-#{$space} {
margin: $remSpace;
}

.p-#{$space} {
padding: $remSpace;
}
}
3 changes: 3 additions & 0 deletions src/styles/isomer-template/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@charset 'UTF-8';

@use "helpers";
1 change: 1 addition & 0 deletions src/styles/preview-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@include meta.load-css("sgds-govtech/css/sgds");
@include meta.load-css("./isomer-template.scss");
@include meta.load-css("./isomer-template/styles.scss");

/*! minireset.css v0.0.2 | MIT License | github.com/jgthms/minireset.css */
blockquote,
Expand Down