From 640202692a0845c1bd6369aabfbc4d0a57966a74 Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:40:19 -0400
Subject: [PATCH 1/7] add grid docs
---
modules/primer-layout/docs/grid.md | 390 +++++++++++++++++++++++++++++
1 file changed, 390 insertions(+)
create mode 100644 modules/primer-layout/docs/grid.md
diff --git a/modules/primer-layout/docs/grid.md b/modules/primer-layout/docs/grid.md
new file mode 100644
index 0000000000..793f440d5b
--- /dev/null
+++ b/modules/primer-layout/docs/grid.md
@@ -0,0 +1,390 @@
+---
+title: Grid
+status: New release
+status_issue: https://github.com/github/design-systems/issues/88
+source: https://github.com/primer/primer-css/blob/master/modules/primer-layout/lib/grid.scss
+---
+
+The grid is 12 columns and percentage-based. The number of columns a container spans can be adjusted across breakpoints for responsive layouts. The grid system works with a variety of layout utilities to achieve different results.
+
+{:toc}
+
+## Float based grid
+
+Use `.clearfix` on the container and float utilities with columns for a floated grid layout.
+
+```html
+
+
+ My column
+
+
+ Looks better
+
+
+ Than your column
+
+
+```
+
+### Reversed grid
+
+To reverse the order of columns, use `float-right` to float columns to the right.
+
+```html
+
+
+ One
+
+
+ Two
+
+
+ Three
+
+
+```
+
+## Nesting
+You can infinitely nest grid layouts within other columns since the column widths are percentage based. With great flexibility comes great responsibility - be sensible with how far you nest!
+
+```html
+
+```
+
+## Centering a column
+
+Use `.mx-auto` to center columns within a container.
+```html
+
+
+ This column is the center of my world.
+
+
+```
+
+
+## Column widths
+Column widths can be used with any other block or inline-block elements to add percentage-based widths.
+```html
+
+
+ <%= octicon "heart" %> Don't go bacon my heart.
+
+
T-bone drumstick alcatra ribeye. Strip steak chuck andouille tenderloin bacon tri-tip ball tip beef capicola rump. Meatloaf bresaola drumstick ball tip salami. Drumstick ham bacon alcatra pig porchetta, spare ribs leberkas pork belly.
+
+```
+
+## Offset columns
+
+Using column offset classes can push a div over X number of columns. They work responsively using the [breakpoints outlined below](/styleguide/css/modules/grid#responsive-grids).
+
+```html
+
+
.offset-1
+
.offset-2
+
+```
+
+## Gutters
+Use gutter styles or padding utilities to create gutters. You can use the default gutter style, `gutter`, or either of its modifiers, `gutter-condensed` or `gutter-spacious`. Gutter styles also support responsive breakpoint modifiers. Gutter styles add padding to the left and right side of each column and apply a negative margin to the container to ensure content inside each column lines up with content outside of the grid.
+
+```html
+
+```
+
+Use padding utilities to create gutters for more customized layouts.
+
+```html
+
+
+```
+
+
+## Inline-block grids
+Use column widths with `d-inline-block` as an alternative to floated grids.
+
+```html
+
+
+ .col-4 .d-inline-block
+
+ .col-4 .d-inline-block
+
+ .col-4 .d-inline-block
+
+
+```
+
+You can use column widths and other utilities on elements such as lists to create the layout you need while keeping the markup semantically correct.
+```html
+
+```
+
+
+## Display table grids
+Using [display table utilities](/styleguide/css/utilities/layout#display) with columns gives you some alternative layout options.
+
+A useful example is being able to keep the height of the container equal across a row when the length of content may differ.
+
+```html
+
+
+ Bacon ipsum dolor amet leberkas pork pig kielbasa shankle ribeye meatball, salami alcatra venison.
+
+ Pork chop cupim cow turkey frankfurter, landjaeger fatback hamburger meatball salami spare ribs. Rump tenderloin salami, hamburger frankfurter landjaeger andouille.
+
+ Brisket tongue frankfurter cupim strip steak rump picanha pancetta pork pig kevin pastrami biltong. Shankle venison meatball swine sausage ground round. Tail pork loin ribeye kielbasa short ribs pork chop.
+
+
+```
+You can also create an alternative [media object](/styleguide/css/utilities/layout#the-media-object) layout with `.display-table` and column widths.
+
+```html
+
+
+

+
+
+
+```
+
+Note that table cells will fill the width of their container even when the total columns doesn't add up to 12.
+
+```html
+
+
+ .col-4 .d-table-cell
+
+ .col-4 .d-table-cell
+
+ .col-2 .d-table-cell
+
+
+```
+
+## Flexbox grids
+
+You can use [flex utilities](/styleguide/css/utilities/flexbox) on the container and columns to create a flexbox grid.
+
+This can be useful for keeping columns the same height, justifying content and vertically aligning items. The flexbox grid is also great for working with responsive layouts.
+
+```html
+
+
+

+
+
+
+```
+
+
+## Responsive grids
+All the column width classes can be set per breakpoint to create responsive grid layouts. Each responsive style is applied to the specified breakpoint and up.
+
+### Breakpoints
+We use abbreviations for each breakpoint to keep the class names concise.
+
+| Shorthand | Description |
+| --- | --- |
+| sm | min-width: 544px |
+| md | min-width: 768px |
+| lg | min-width: 1004px |
+| xl | min-width: 1280px |
+
+**Note:** The `lg` breakpoint matches our current page width of `980px` including left and right padding of `12px`. This is so that content doesn't touch the edges of the window when resized.
+
+
+
+In this example at the `sm` breakpoint 2 columns will show, at the `md` breakpoint 4 columns will show, and at the `lg` breakpoint 6 columns will show.
+
+```html
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+ .col-sm-6 .col-md-3 .col-lg-2
+
+
+```
+
+For demonstration, this is how the above example would look at the `sm` breakpoint.
+
+```html
+
+
+ .col-sm-6
+
+
+ .col-sm-6
+
+
+ .col-sm-6
+
+
+ .col-sm-6
+
+
+ .col-sm-6
+
+
+ .col-sm-6
+
+
+```
+This is how that same example would look at the `md` breakpoint.
+
+```html
+
+
+ .col-md-3
+
+
+ .col-md-3
+
+
+ .col-md-3
+
+
+ .col-md-3
+
+
+ .col-md-3
+
+
+ .col-md-3
+
+
+```
+
+This is how that example would look at the `lg` breakpoint.
+
+```html
+
+
+ .col-lg-2
+
+
+ .col-lg-2
+
+
+ .col-lg-2
+
+
+ .col-lg-2
+
+
+ .col-lg-2
+
+
+ .col-lg-2
+
+
+```
+
+## Containers
+Container widths match our breakpoints and are available at a `md`, `lg`, and `xl` size. Containers apply a max-width rather than a fixed width for responsive layouts, and they center the container.
+
+```html
+
+ .container-md, max-width 768px
+
+
+
+ .container-lg, max-width 1012px
+
+
+
+ .container-xl, max-width 1280px
+
+```
+
+**Note:** `.container` is being replaced with `.container-lg`. To match the current fixed page width use `.container-lg` with `px-3`. This gives the container padding on smaller screens which works better for responsive layouts.
From 51b04606dbe309b7d95c58cd1b27cab44268c111 Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:40:45 -0400
Subject: [PATCH 2/7] add docs to layout package.jsom
---
modules/primer-layout/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/primer-layout/package.json b/modules/primer-layout/package.json
index 1f2d6bb372..ac67d83b02 100644
--- a/modules/primer-layout/package.json
+++ b/modules/primer-layout/package.json
@@ -10,7 +10,8 @@
"files": [
"index.scss",
"lib",
- "build"
+ "build",
+ "docs"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-layout",
"bugs": {
From 22a23c2b4c93dc2a1e41337dbb7bd3e3dcae2f69 Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:41:18 -0400
Subject: [PATCH 3/7] add docs to files key in package.json
---
modules/primer-utilities/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/primer-utilities/package.json b/modules/primer-utilities/package.json
index f53eec8b36..57313072b5 100644
--- a/modules/primer-utilities/package.json
+++ b/modules/primer-utilities/package.json
@@ -10,7 +10,8 @@
"files": [
"index.scss",
"lib",
- "build"
+ "build",
+ "docs"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-utilities",
"bugs": {
From 944bd610831d2c307614e10a9bf9ab2fc6dc0b8f Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:42:19 -0400
Subject: [PATCH 4/7] add docs to files key in marketing-utilitis package.json
---
modules/primer-marketing-utilities/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/primer-marketing-utilities/package.json b/modules/primer-marketing-utilities/package.json
index 822de98e17..50b5b7dee3 100644
--- a/modules/primer-marketing-utilities/package.json
+++ b/modules/primer-marketing-utilities/package.json
@@ -10,7 +10,8 @@
"files": [
"index.scss",
"lib",
- "build"
+ "build",
+ "docs"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-marketing-utilities",
"bugs": {
From 737d343d917c1cc110c5978372a101c4265f45ad Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:47:28 -0400
Subject: [PATCH 5/7] add support docs for breakpoints, color-system, spacing,
and typography
---
modules/primer-support/docs/breakpoints.md | 60 +++
modules/primer-support/docs/color-system.md | 392 ++++++++++++++++++++
modules/primer-support/docs/spacing.md | 50 +++
modules/primer-support/docs/typography.md | 90 +++++
4 files changed, 592 insertions(+)
create mode 100644 modules/primer-support/docs/breakpoints.md
create mode 100644 modules/primer-support/docs/color-system.md
create mode 100644 modules/primer-support/docs/spacing.md
create mode 100644 modules/primer-support/docs/typography.md
diff --git a/modules/primer-support/docs/breakpoints.md b/modules/primer-support/docs/breakpoints.md
new file mode 100644
index 0000000000..f34a2f3eb6
--- /dev/null
+++ b/modules/primer-support/docs/breakpoints.md
@@ -0,0 +1,60 @@
+---
+title: Breakpoints
+status: Stable
+source: https://github.com/primer/primer-css/blob/master/modules/primer-support/lib/mixins/layout.scss
+---
+
+{:toc}
+
+Our breakpoints are based on screen widths where our content starts to break. Since most of GitHub is currently a fixed-width with we use pixel widths to make it easy for us to match page widths for responsive and non-responsive pages. **Our breakpoints may change as we move more of the product into responsive layouts.**
+
+We use abbreviations for each breakpoint to keep the class names concise. This abbreviated syntax is used consistently across responsive styles. Responsive styles allow you to change the styles properties at each breakpoint. For example, when using column widths for grid layouts, you can change specify that the width is 12 columns wide at the small breakpoint, and 6 columns wide from the large breakpoint: `...
`
+
+| Breakpoint | Syntax | Description |
+| --- | --- | --- |
+| Small | sm | min-width: 544px |
+| Medium | md | min-width: 768px |
+| Large | lg | min-width: 1012px |
+| Extra-large | xl | min-width: 1280px |
+
+**Note:** The `lg` breakpoint matches our current page width of `980px` including left and right padding of `16px` (`$spacer-3`). This is so that content doesn't touch the edges of the window when resized.
+
+Responsive styles are available for [margin](./utilities/margin#responsive-margin), [padding](./utilities/padding#responsive-padding), [layout](./utilities/layout), [flexbox](.utilities/flexbox#responsive-flex-utilities), and the [grid](./objects/grid#responsive-grids) system.
+
+## Breakpoint variables
+
+The above values are defined as variables, and then put into a Sass map that generates the media query mixin.
+
+```scss
+
+// breakpoints
+$width-xs: 0;
+$width-sm: 544px;
+$width-md: 768px;
+$width-lg: 1012px;
+$width-xl: 1280px;
+
+$breakpoints: (
+ // Small screen / phone
+ sm: $width-sm,
+ // Medium screen / tablet
+ md: $width-md,
+ // Large screen / desktop (980 + (12 * 2)) <= container + gutters
+ lg: $width-lg,
+ // Extra large screen / wide desktop
+ xl: $width-xl
+) !default;
+
+```
+
+## Media query mixins
+Use media query mixins when you want to change CSS properties at a particular breakpoint. The media query mixin works by passing in a breakpoint value, such as `breakpoint(md)`.
+
+Media queries are scoped from each breakpoint and upwards. In the example below, the font size is `28px` until the viewport size meets the `lg` breakpoint, from there upwards—including through the `xl` breakpoint—the font size will be `32px`.
+
+```
+.styles {
+ font-size: 28px;
+ @include breakpoint(md) { font-size: 32px; }
+}
+```
diff --git a/modules/primer-support/docs/color-system.md b/modules/primer-support/docs/color-system.md
new file mode 100644
index 0000000000..449deb81f0
--- /dev/null
+++ b/modules/primer-support/docs/color-system.md
@@ -0,0 +1,392 @@
+---
+title: Color system
+status_issue: https://github.com/github/design-systems/issues/301
+status: New release
+source: https://github.com/primer/primer-css/blob/master/modules/primer-support/lib/variables/color-system.scss
+---
+
+{:toc}
+
+## Color palette
+
+
+
+## Color variables
+
+
+
+
+
Gray
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Blue
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Green
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Purple
+
+
Purple
+
+
$purple-500
+
#6f42c1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Yellow
+
+
Yellow
+
+
$yellow-500
+
#ffd93d
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Orange
+
+
Orange
+
+
$orange-500
+
#f66a0a
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Red
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Black fades
+
+
Black
+
+
$black
+
rgb(27,31,35) #1b1f23
+
+
Black fades apply alpha transparency to the $black variable. The black color value has a slight blue hue to match our grays.
+
+
+
+
+
+
+
+
+
+
White fades
+
+
White
+
+
$white
+
rgb(255, 255, 255) #fff
+
+
White fades apply alpha transparency to the $white variable, below these are shown overlaid on a dark gray background.
+
+
+
+
+
+
+
diff --git a/modules/primer-support/docs/spacing.md b/modules/primer-support/docs/spacing.md
new file mode 100644
index 0000000000..262495e639
--- /dev/null
+++ b/modules/primer-support/docs/spacing.md
@@ -0,0 +1,50 @@
+---
+title: Spacing
+status: Stable
+source: https://github.com/primer/primer-css/blob/master/modules/primer-support/lib/variables/layout.scss
+---
+
+{:toc}
+
+## Spacing scale
+The spacing scale is a **base-8** scale. We chose a base-8 scale because eight is a highly composable number (it can be divided and multiplied many times and result in whole numbers), yet allows spacing dense enough for GitHub's UI. The scale's exception is that it begins at 4px to allow smaller padding and margin for denser parts of the site, from there on it steps up consistently in equal values of `8px`.
+
+| Scale | Value |
+| --- | --- |
+| 0 | 0 |
+| 1 | 4px |
+| 2 | 8px |
+| 3 | 16px |
+| 4 | 24px |
+| 5 | 32px |
+| 6 | 40px |
+
+The spacing scale is used for [margin](./utilities/margin) and [padding](./utilities/padding) utilities, and via variables within components.
+
+## Em-based spacing
+Ems are used for spacing within components such as buttons and form elements. We stick to common fractions for em values so that, in combination with typography and line-height, the total height lands on sensible numbers.
+
+We aim for whole numbers, however, GitHub's body font-size is 14px which is difficult to work with, so we sometimes can't achieve a whole number. Less desirable values are highlighted in red below.
+
+| Fraction | Y Padding (em) | Total height at 14px | Total height at 16px |
+| --- | --- | --- | --- |
+| 3/4 | .75 | 42 | 48 |
+| 1/2 | .5 | 35 | 40 |
+| 3/8 | .375 | 31.5 | 36 |
+| 1/4 | .25 | 28 | 32 |
+| 1/8 | .125 | 24.5 | 28 |
+
+We recommend using the fractions shown above. To calculate values with other font-sizes or em values, we suggest using [Formula](http://jxnblk.com/formula/).
+
+## Spacer Variables
+
+These variables match the above scale and are encouraged to be used within components. They are also used in our [margin](./utilities/margin) and [padding utilities](./utilities/padding).
+
+```scss
+$spacer-1: 4px;
+$spacer-2: 8px;
+$spacer-3: 16px;
+$spacer-4: 24px;
+$spacer-5: 32px;
+$spacer-6: 40px;
+```
diff --git a/modules/primer-support/docs/typography.md b/modules/primer-support/docs/typography.md
new file mode 100644
index 0000000000..2eb4b9a9c7
--- /dev/null
+++ b/modules/primer-support/docs/typography.md
@@ -0,0 +1,90 @@
+---
+title: Typography
+status_issue: https://github.com/github/design-systems/issues/329
+status: New release
+source: https://github.com/primer/primer-css/blob/master/modules/primer-support/lib/variables/typography.scss
+---
+
+{:toc}
+
+## Type Scale
+
+The typography scale is designed to work for GitHub's product UI and marketing sites. Font sizes are designed to work in combination with line-height values so as to result in more sensible numbers wherever possible.
+
+Font sizes are smaller on mobile and scale up at the `md` [breakpoint](#breakpoints) to be larger on desktop.
+
+| Scale | Font size: mobile | Font size: desktop | 1.25 line height | 1.5 line height |
+| --- | --- | --- | --- | --- |
+| 00 | 40px | 48px | 60 | 72 |
+| 0 | 32px | 40px | 50 | 60 |
+| 1 | 26px | 32px | 40 | 48 |
+| 2 | 22px | 24px | 30 | 36 |
+| 3 | 18px | 20px | 25 | 30 |
+| 4 | 16px | 16px | 20 | 24 |
+| 5 | 14px | 14px | 17.5 | 21 |
+| 6 | 12px | 12px | 15 | 18 |
+
+The typography scale is used to create [typography utilities](./utilities/typography).
+
+## Typography variables
+
+#### Font size variables
+```scss
+// Heading sizes - mobile
+// h4—h6 remain the same size on both mobile & desktop
+$h00-size-mobile: 40px;
+$h0-size-mobile: 32px;
+$h1-size-mobile: 26px;
+$h2-size-mobile: 22px;
+$h3-size-mobile: 18px;
+
+// Heading sizes - desktop
+$h00-size: 48px;
+$h0-size: 40px;
+$h1-size: 32px;
+$h2-size: 24px;
+$h3-size: 20px;
+$h4-size: 16px;
+$h5-size: 14px;
+$h6-size: 12px;
+```
+
+#### Font weight variables
+```scss
+$font-weight-bold: 600 !default;
+$font-weight-light: 300 !default;
+```
+
+#### Line height variables
+```scss
+$lh-condensed-ultra: 1 !default;
+$lh-condensed: 1.25 !default;
+$lh-default: 1.5 !default;
+```
+
+## Typography Mixins
+Typography mixins are available for heading styles and for our type scale. They can be used within components or custom CSS. The same styles are also available as [utilities](./utilities/typography#heading-utilities) which requires no additional CSS.
+
+Heading mixins are available for `h1` through to `h6`, this includes the font-size and font-weight. Example:
+
+```scss
+.styles {
+ @include h1;
+}
+```
+
+Responsive heading mixins can be used to adjust the font-size between the `sm` and `lg` breakpoint. Only headings 1—3 are responsive. Heading 4—6 are small enough to remain the same between mobile and desktop. Responsive heading mixins include the font-size and font-weight as well as the media query. To use a responsive heading mixin, postfix the heading with `-responsive`:
+
+```scss
+.styles {
+ @include h1-responsive;
+}
+```
+
+Responsive type scale mixins are also available. Type scale mixins apply a font-size that gets slightly bigger at the `lg` breakpoint. They do not apply a font-weight. Like the responsive heading mixins, they are only available for size `f1` to `f3` and are postfixed with `-responsive` as in the example below:
+
+```scss
+.style {
+ @include f1-responsive;
+}
+```
From d3ce5580d07b4a2ffd62da4a288c73fef55aaada Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:49:54 -0400
Subject: [PATCH 6/7] add docs to primer-support readme
---
modules/primer-support/README.md | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/modules/primer-support/README.md b/modules/primer-support/README.md
index 6aa88a8045..f09b2e28a0 100644
--- a/modules/primer-support/README.md
+++ b/modules/primer-support/README.md
@@ -29,7 +29,21 @@ You can also import specific portions of the module by importing those partials
## Documentation
-You can read more about support in the [docs][docs].
+
+
+Primer is built on systems that form the foundation of our styles, and inform the way we write and organize our CSS. Building upon systems helps us make styles consistent and interoperable with each other, and assists us with visual hierarchy and vertical rhythm.
+
+We use Sass variables to keep color, typography, spacing, and other foundations of our system consistent. Occasionally we use Sass mixins to apply multiple CSS properties, they are a convenient solution for frequently-used verbose patterns.
+
+We've documented variables, mixins, and the systems they are built on for the following:
+- [Breakpoints](./support/breakpoints)
+- [Colors](./support/color-system)
+- [Spacing](./support/spacing)
+- [Typography](./support/typography)
+
+
## License
From c476d93b57076eb45c10fcddfbcfac222fd256ff Mon Sep 17 00:00:00 2001
From: broccolini
Date: Wed, 9 Aug 2017 16:50:25 -0400
Subject: [PATCH 7/7] add docs to files key in primer-support package.json
---
modules/primer-support/package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/primer-support/package.json b/modules/primer-support/package.json
index ecc575521b..fd8b7df64a 100644
--- a/modules/primer-support/package.json
+++ b/modules/primer-support/package.json
@@ -8,7 +8,8 @@
"style": "index.scss",
"files": [
"index.scss",
- "lib"
+ "lib",
+ "docs"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-support",
"bugs": {