-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Increase spacing scale #376
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
Changes from all commits
ca1c8cd
78c5518
cb8ef3a
f802e42
839ce8d
3692d95
d1e3455
e12c3e2
728215f
4b6e983
7ab3261
2055351
7c8b3be
7b55844
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm should I move these variables to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep them there, it allows them to be used in any modules for marketing. |
||
|
|
||
| // 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; | ||
| 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> | ||
| ``` |
| 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> | ||
| ``` |
| 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"; |
| 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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Niiice |
||
| $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; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| 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; | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage instructions should follow
## Install, it probably got missed with other updates 😬. Would you mind adding it? You can copy this section and update to sayprimer-marketing-support: https://github.com/primer/primer/blob/master/modules/primer-support/README.md#usageThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage is already included below
## Installhere :) https://github.com/primer/primer/pull/376/files/7c8b3be162835cc4d51fedbb9f74d6f9036198ed#diff-e22f2520c00c79678dbb5d56c4e38b6aR20There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I missed that!