-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #376 from primer/increase-spacing-scale
Increase spacing scale
- Loading branch information
Showing
10 changed files
with
264 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
// Type | ||
$alt-body-font: Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Open Sans", sans-serif; | ||
$alt-mono-font: $mono-font; | ||
|
||
// Increases primer-core scale first by 8px for spacer-7 then by 16px step increments for spacer-8 to spacer-12 | ||
// i.e. After 40px, we have 48, 64, 80, 96, etc. | ||
$spacer-7: $spacer * 6; // 48px | ||
$spacer-8: $spacer * 8; // 64px | ||
$spacer-9: $spacer * 10; // 80px | ||
$spacer-10: $spacer * 12; // 96px | ||
$spacer-11: $spacer * 14; // 112px | ||
$spacer-12: $spacer * 16; // 128px | ||
|
||
$marketingSpacers: $spacer-7, $spacer-8, $spacer-9, $spacer-10, $spacer-11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Marketing Margin | ||
status: New release | ||
status_issue: https://github.com/github/design-systems/issues/378 | ||
--- | ||
|
||
Marketing margin utilities extend [core margin utilities](../../primer-marketing-support/docs/spacing) across the y-axis only. The [marketing scale](../../primer-marketing-support) starts from spacer 7 up to 12, and steps first by `8px` for spacer 7 and continues in increments of `16px` for spacer 8 to 12. | ||
|
||
## Y-axis margin utilities | ||
|
||
Use marketing margin utilities to apply margin to top, bottom, or both y-axis of an element. These utilities can change or override default margins, and can be used with a spacing scale of 7-12. | ||
|
||
```html | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue mt-7">.mt-7</div> | ||
</div> | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue mb-7">.mb-7</div> | ||
</div> | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue my-7">.my-7</div> | ||
</div> | ||
``` | ||
|
||
## Responsive y-axis margin utilities | ||
|
||
All marketing margin utilities can be adjusted per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formula: `m[y-direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up. | ||
|
||
```html | ||
<div class="d-inline-block margin-orange"> | ||
<div class="my-sm-7 mb-lg-9 d-inline-block block-blue"> | ||
.my-sm-7 .mb-lg-9 | ||
</div> | ||
</div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Marketing Padding | ||
status: New release | ||
status_issue: https://github.com/github/design-systems/issues/378 | ||
--- | ||
|
||
Marketing padding utilities extend [core margin utilities](../../primer-marketing-support/docs/spacing) across the y-axis only. The [marketing scale](../../primer-marketing-support) starts from spacer 7 up to 12, and steps first by `8px` for spacer 7 and continues in increments of `16px` for spacer 8 to 12. | ||
|
||
## Y-axis padding utilities | ||
|
||
Use marketing padding utilities to apply padding to top, bottom, or both y-axis of an element. These utilities can change or override default padding, and can be used with a spacing scale of 7-12. | ||
|
||
```html | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue pt-7">.pt-7</div> | ||
</div> | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue pb-7">.pb-7</div> | ||
</div> | ||
<div class="margin-orange d-inline-block"> | ||
<div class="d-inline-block block-blue py-7">.py-7</div> | ||
</div> | ||
``` | ||
|
||
## Responsive y-axis padding utilities | ||
|
||
All marketing padding utilities can be adjusted per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formula: `p[y-direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up. | ||
|
||
```html | ||
<div class="d-inline-block margin-orange"> | ||
<div class="py-sm-7 pb-lg-9 d-inline-block block-blue"> | ||
.py-sm-7 .pb-lg-9 | ||
</div> | ||
</div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
@import "primer-support/index.scss"; | ||
@import "primer-marketing-support/index.scss"; | ||
// utilities | ||
@import "./lib/filters.scss"; | ||
@import "./lib/borders.scss"; | ||
@import "./lib/layout.scss"; | ||
@import "./lib/margin.scss"; | ||
@import "./lib/padding.scss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Margin spacer utilities for marketing | ||
// Utilities only added for y-direction margin (i.e. top & bottom) | ||
// stylelint-disable block-opening-brace-space-before, declaration-colon-space-before, primer/selector-no-utility, comment-empty-line-before | ||
@for $i from 1 through length($marketingSpacers) { | ||
$size: #{nth($marketingSpacers, $i)}; | ||
$scale: #{$i + 6}; // 7, 8, 9, 10, 11 | ||
|
||
/* Set a #{$size} margin on the top */ | ||
.mt-#{$scale} { margin-top : #{$size} !important; } | ||
/* Set a #{$size} margin on the bottom */ | ||
.mb-#{$scale} { margin-bottom: #{$size} !important; } | ||
|
||
/* Set a #{$size} margin on the top & bottom */ | ||
.my-#{$scale} { | ||
margin-top : #{$size} !important; | ||
margin-bottom: #{$size} !important; | ||
} | ||
} | ||
|
||
// Loop through the breakpoint values | ||
@each $breakpoint in map-keys($breakpoints) { | ||
|
||
// Loop through the spacer values | ||
@for $i from 1 through length($marketingSpacers) { | ||
@include breakpoint($breakpoint) { | ||
$size: #{nth($marketingSpacers, $i)}; // sm, md, lg, xl | ||
$scale: #{$i + 6}; // 7, 8, 9, 10, 11 | ||
|
||
/* Set a #{$size} margin on the top at the breakpoint #{$breakpoint} */ | ||
.mt-#{$breakpoint}-#{$scale} { margin-top: #{$size} !important; } | ||
/* Set a #{$size} margin on the bottom at the breakpoint #{$breakpoint} */ | ||
.mb-#{$breakpoint}-#{$scale} { margin-bottom: #{$size} !important; } | ||
|
||
/* Set a #{$size} margin on the top & bottom at the breakpoint #{$breakpoint} */ | ||
.my-#{$breakpoint}-#{$scale} { | ||
margin-top: #{$size} !important; | ||
margin-bottom: #{$size} !important; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Padding spacer utilities for marketing | ||
// stylelint-disable block-opening-brace-space-before, declaration-colon-space-before | ||
// stylelint-disable comment-empty-line-before | ||
@for $i from 1 through length($marketingSpacers) { | ||
$size: #{nth($marketingSpacers, $i)}; | ||
$scale: #{$i + 6}; // 7, 8, 9, 10, 11 | ||
|
||
/* Set a #{$size} padding to the top */ | ||
.pt-#{$scale} { padding-top : #{$size} !important; } | ||
/* Set a #{$size} padding to the bottom */ | ||
.pb-#{$scale} { padding-bottom: #{$size} !important; } | ||
|
||
/* Set a #{$size} padding to the top & bottom */ | ||
.py-#{$scale} { | ||
padding-top: #{$size} !important; | ||
padding-bottom: #{$size} !important; | ||
} | ||
} | ||
|
||
// Responsive padding spacer utilities | ||
|
||
// Loop through the breakpoint values | ||
@each $breakpoint in map-keys($breakpoints) { | ||
|
||
// Loop through the spacer values | ||
@for $i from 1 through length($marketingSpacers) { | ||
@include breakpoint($breakpoint) { | ||
$size: #{nth($marketingSpacers, $i)}; // xs, sm, md, lg, xl | ||
$scale: #{$i + 6}; // 7, 8, 9, 10, 11 | ||
|
||
/* Set a #{$size} padding to the top at the #{$breakpoint} breakpoint */ | ||
.pt-#{$breakpoint}-#{$scale} { padding-top: #{$size} !important; } | ||
/* Set a #{$size} padding to the bottom at the #{$breakpoint} breakpoint */ | ||
.pb-#{$breakpoint}-#{$scale} { padding-bottom: #{$size} !important; } | ||
|
||
/* Set a #{$size} padding to the top & bottom at the #{$breakpoint} breakpoint */ | ||
.py-#{$breakpoint}-#{$scale} { | ||
padding-top: #{$size} !important; | ||
padding-bottom: #{$size} !important; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters