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

Added support for negative offset columns with responsive support #639

Merged
merged 10 commits into from
Mar 1, 2019
16 changes: 7 additions & 9 deletions script/selector-diff-report
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ function log() {
echo "$@" 1>&2
}

function warn() {
echo "$@" 1>&2
}

pkg="@primer/css"
path="dist/stats/primer.json"
log "Pulling the old $path from unpkg.com..."
warn "Pulling the old $path from unpkg.com..."
curl -sL "https://unpkg.com/$pkg/$path" > before.json

if [[ ! -f $path ]]; then
log "Building the stats locally..."
npm run dist
fi
warn "Building the stats locally..."
npm run --silent dist
cp $path after.json

function list_selectors() {
Expand All @@ -24,10 +26,6 @@ key=".selectors.values[]"
jq -r $key before.json > before.txt
jq -r $key after.json > after.txt

function warn() {
echo "$@" 1>&2
}

warn "[selector report] diff:"
(diff before.txt after.txt | tee selector-diff.log) || log "(no diff!)"
warn "[selector report] end"
Expand Down
11 changes: 11 additions & 0 deletions src/marketing/utilities/docs/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ In an effort to reduce the size of our CSS, responsive breakpoints are only supp
<div class="border bg-white position-lg-absolute left-lg-1">.left-lg-1</div>
</div>
```

## Negative offset columns

Using column offset classes can pull a div over X number of columns to the left. Negative offsets are available in [spacings from 1](../support/spacing/#spacing-scale) [to 7](../support/marketing-variables/).

```html
<div class="clearfix">
<div class="offset-n1 col-3 border p-3">.offset-n1</div>
<div class="offset-n2 col-3 border p-3">.offset-n2</div>
</div>
```
9 changes: 9 additions & 0 deletions src/marketing/utilities/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@
}
}
}

// Negative offset columns
@each $breakpoint, $variant in $responsive-variants {
@include breakpoint($breakpoint) {
@for $offset from 1 through 7 {
.offset#{$variant}-n#{$offset} { margin-left: -($offset / 12 * 100%); }
}
}
}