1
1
mirror of https://github.com/primer/css.git synced 2025-01-01 18:53:34 +03:00

Merge pull request #481 from primer/task/styleguide-polish

Styleguide Polish
This commit is contained in:
Jon Rohan 2018-05-08 14:48:19 -07:00 committed by GitHub
commit 87fbb5dc7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 42 additions and 41 deletions

View File

@ -259,7 +259,7 @@ Use `Box--danger` to apply a red border to the outside of the box. This theme is
</div>
```
`Box-danger` is often paired with a red heading. See the [subhead](/styleguide/css/styles/product/components/subhead) docs for more information.
`Box-danger` is often paired with a red heading. See the [subhead](../subhead) docs for more information.
```html
<div class="Subhead border-bottom-0">
@ -356,7 +356,7 @@ Use the `border-dashed` utility to apply a dashed border to a box.
## Boxes with flash alerts
Use `flash-full` for flash alert inside a box to remove the rounded corners. Place the flash alert above the `Box-body` and underneath the `Box-header`.
Flash alerts come in three different colors and can be used with icons and buttons, see the [alert documentation](/alerts) for more information.
Flash alerts come in three different colors and can be used with icons and buttons, see the [alert documentation](../alerts) for more information.
```html
<div class="Box">
@ -455,7 +455,7 @@ Use `Counter--gray-dark` for a counter with a dark gray background and white tex
## Form elements and buttons in boxes
To achieve different layouts when adding buttons or form elements to boxes we suggest you use utilities to achieve the layout you want. Here's some common examples:
Use [flexbox utilities](../utilities/flexbox) to center align items, and avoid using floats by using `flex-auto` to have the text fill the remaining space so that the button rests on the far right.
Use [flexbox utilities](../../utilities/flexbox) to center align items, and avoid using floats by using `flex-auto` to have the text fill the remaining space so that the button rests on the far right.
```html
<div class="Box Box--condensed">
@ -561,7 +561,7 @@ You can put forms in boxes. Often form submission buttons are aligned to the bot
</div>
```
When a box is all by itself centered on a page you can use [column widths](/grid) to control the width of the box. If needed, break the mold a little and use [typography utilities](../utilities/typography) instead of the built in box title styles.
When a box is all by itself centered on a page you can use [column widths](../../objects/grid) to control the width of the box. If needed, break the mold a little and use [typography utilities](../../utilities/typography) instead of the built in box title styles.
```html
<div class="Box Box--spacious col-6 mx-auto text-center">
@ -582,7 +582,7 @@ When a box is all by itself centered on a page you can use [column widths](/grid
</div>
```
Box patterns can also be made with, and modified with [border utilities](../utilities/borders).
Box patterns can also be made with, and modified with [border utilities](../../utilities/borders).
<!-- %enddocs -->

View File

@ -175,7 +175,7 @@ You can easily append a count to a **small button**. Add the `.with-count` class
</div>
```
You can also use the [counter](../../product/components/labels) component within buttons:
You can also use the [counter](../labels#counters) component within buttons:
```html
<button class="btn" type="button">

View File

@ -176,7 +176,7 @@ Primer adds light `height` and `vertical-align` styles to `<select>`s for all br
##### Small
Use the `.select-sm` class to resize both default and custom `<select>`s to match the size of [our small buttons](/buttons/#default-buttons).
Use the `.select-sm` class to resize both default and custom `<select>`s to match the size of [our small buttons](../buttons/#default-buttons).
```html
<select class="form-select select-sm" aria-label="Preference">

View File

@ -137,7 +137,7 @@ Use the `Counter` component to add a count to navigational elements and buttons.
<span class="Counter Counter--gray-light">64</span>
```
Use the `Counter` in navigation to indicate the number of items without the user having to click through or count the items, such as open issues in a GitHub repo. See more options in [navigation](../../core/components/navigation).
Use the `Counter` in navigation to indicate the number of items without the user having to click through or count the items, such as open issues in a GitHub repo. See more options in [navigation](../navigation).
```html title="Counter in tabs"
<div class="tabnav">
@ -148,7 +148,7 @@ Use the `Counter` in navigation to indicate the number of items without the user
</div>
```
Counters can also be used in `Box` headers to indicate the number of items in a list. See more on the [box component](../../core/components/box).
Counters can also be used in `Box` headers to indicate the number of items in a list. See more on the [box component](../box).
```html title="Counter in Box headers"
<div class="Box">

View File

@ -115,7 +115,7 @@ In practice, your columns will look like the example below.
##### Centered
Columns can be [centered](/utilities/#centering-content) by adding `.centered` to the `.column` class.
Columns can be centered by adding `.centered` to the `.column` class.
```html title="Grid centered"
<div class="columns">

View File

@ -98,7 +98,7 @@ Column widths can be used with any other block or inline-block elements to add p
## 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).
Using column offset classes can push a div over X number of columns. They work responsively using the [breakpoints outlined below](../grid#responsive-grids).
```html title="Offset columns"
<div class="clearfix">
@ -188,7 +188,7 @@ You can use column widths and other utilities on elements such as lists to creat
## Display table grids
Using [display table utilities](/styleguide/css/utilities/layout#display) with columns gives you some alternative layout options.
Using [display table utilities](../../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.
@ -205,7 +205,7 @@ A useful example is being able to keep the height of the container equal across
</div>
</div>
```
You can also create an alternative [media object](/styleguide/css/utilities/layout#the-media-object) layout with `.display-table` and column widths.
You can also create an alternative [media object](../../utilities/layout#the-media-object) layout with `.display-table` and column widths.
```html title="Table grid alternative"
<div class="d-table col-12">
@ -238,7 +238,7 @@ Note that table cells will fill the width of their container even when the total
## Flexbox grids
You can use [flex utilities](/styleguide/css/utilities/flexbox) on the container and columns to create a flexbox grid.
You can use [flex utilities](../../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.

View File

@ -48,7 +48,7 @@ Starting where the `primer-core` spacing scale ends at spacer 6, the marketing s
| 11 | 112 |
| 12 | 128 |
See [primer-marketing-utilities](../primer-marketing-utilities) for related spacing utilities.
See [primer-marketing-support](../../support/marketing-variables/) for the extended spacing scale used for marketing needs and the related y-axis spacing utilities for [margin](../../utilities/marketing-margin) and [padding](../../utilities/marketing-padding).
<!-- %enddocs -->

View File

@ -21,7 +21,7 @@ Top, right, bottom, and left border utilities are can be used responsively to ad
### White border with alpha transparency
Use `.border-white-fade` to add a white border with an alpha transparency of 0.15. This is useful when you want a border that is a lighter shade of the background color. Additional border colors are available in [primer-core border utilities](/borders/#border-colors).
Use `.border-white-fade` to add a white border with an alpha transparency of 0.15. This is useful when you want a border that is a lighter shade of the background color. Additional border colors are available in [primer-core border utilities](..//borders/#border-colors).
```html
<div class="bg-gray-dark text-white p-3 mb-2">

View File

@ -3,7 +3,7 @@ title: Layout
status: New release
---
Marketing layout utilities build on top of [primer-core utilities](/layout/#position), adding the option of responsive positioning.
Marketing layout utilities build on top of [primer-core utilities](../../utilities/layout/#position), adding the option of responsive positioning.
{:toc}

View File

@ -4,7 +4,8 @@ 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.
Marketing margin utilities extend [core margin utilities](../../support/spacing) across the y-axis only. The [marketing scale](../../support/marketing-variables/#extended-spacing-scale) 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
@ -24,7 +25,7 @@ Use marketing margin utilities to apply margin to top, bottom, or both y-axis of
## 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.
All marketing margin utilities can be adjusted per [breakpoint](../../objects/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">

View File

@ -4,7 +4,7 @@ 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.
Marketing padding utilities extend [core margin utilities](../../support/spacing) across the y-axis only. The [marketing scale](../../support/marketing-variables/#extended-spacing-scale) 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
@ -24,7 +24,7 @@ Use marketing padding utilities to apply padding to top, bottom, or both y-axis
## 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.
All marketing padding utilities can be adjusted per [breakpoint](../../objects/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">

View File

@ -19,7 +19,7 @@ We use abbreviations for each breakpoint to keep the class names concise. This a
<small>**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.</small>
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.
Responsive styles are available for [margin](../../utilities/margin/#responsive-margins), [padding](../../utilities/padding#responsive-padding), [layout](../../utilities/layout), [flexbox](../../utilities/flexbox#responsive-flex-utilities), and the [grid](../../objects/grid#responsive-grids) system.
## Breakpoint variables

View File

@ -19,9 +19,9 @@ The spacing scale is a **base-8** scale. We chose a base-8 scale because eight i
| $spacer-5 | 5 | 32px |
| $spacer-6 | 6 | 40px |
These variables are encouraged to be used within components and custom CSS. The spacing scale is also used for [margin](./utilities/margin) and [padding](./utilities/padding) utilities.
These variables are encouraged to be used within components and custom CSS. The spacing scale is also used for [margin](../../utilities/margin) and [padding](../../utilities/padding) utilities.
See [primer-marketing-support](../primer-marketing-support) for the extended spacing scale used for marketing needs and the related y-axis spacing utilities for [margin](../primer-marketing-utilities/docs/margin.md) and [padding](../primer-marketing-utilities/docs/padding.md).
See [primer-marketing-support](../../support/marketing-variables/) for the extended spacing scale used for marketing needs and the related y-axis spacing utilities for [margin](../../utilities/marketing-margin) and [padding](../../utilities/marketing-padding).
## Em-based spacing
Ems are used for spacing within components such as buttons and form elements. We stick to common fractions for em values (and powers of 2 where possible) so that , in combination with typography and line-height, the total height lands on sensible numbers.

View File

@ -11,7 +11,7 @@ source: https://github.com/primer/primer/blob/master/modules/primer-support/lib/
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.
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 |
| --- | --- | --- | --- | --- |
@ -24,7 +24,7 @@ Font sizes are smaller on mobile and scale up at the `md` [breakpoint](#breakpoi
| 5 | 14px | 14px | 17.5 | 21 |
| 6 | 12px | 12px | 15 | 18 |
The typography scale is used to create [typography utilities](./utilities/typography).
The typography scale is used to create [typography utilities](../../utilities/typography).
## Typography variables
@ -63,7 +63,7 @@ $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.
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:

View File

@ -13,7 +13,7 @@ Use color utilities to apply color to the background of elements, text, and bord
## Background colors
Background colors are most commonly used for filling large blocks of content or areas with a color. When selecting a background color, make sure the foreground color contrast passes a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). Meeting these standards ensures that content is accessible by everyone, regardless of disability or user device. You can [check your color combination with this demo site](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/styleguide/css/principles/accessibility).
Background colors are most commonly used for filling large blocks of content or areas with a color. When selecting a background color, make sure the foreground color contrast passes a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). Meeting these standards ensures that content is accessible by everyone, regardless of disability or user device. You can [check your color combination with this demo site](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/primer/principles/accessibility).
### Gray
@ -127,7 +127,7 @@ Background colors are most commonly used for filling large blocks of content or
## Text colors
Use text color utilities to set text or [octicons](/styleguide/css/styles/core/components/octicons) to a specific color. Color contrast must pass a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). This ensures that viewers who cannot see the full color spectrum are able to read the text. To customize outside of the suggested combinations below, we recommend using this [color contrast testing tool](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/styleguide/css/principles/accessibility).
Use text color utilities to set text or [octicons](/styleguide/css/styles/core/components/octicons) to a specific color. Color contrast must pass a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). This ensures that viewers who cannot see the full color spectrum are able to read the text. To customize outside of the suggested combinations below, we recommend using this [color contrast testing tool](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/primer/principles/accessibility).
These are our most common text with background color combinations. They don't all pass accessibility standards currently, but will be updated in the future. **Any of the combinations with a warning icon must be used with caution**.
@ -229,4 +229,4 @@ Use `link-hover-blue` to make any text color used with links to turn blue on hov
## Border colors
Border colors are documented on the [border utilities page](/styleguide/css/styles/core/utilities/borders#border-width-style-and-color-utilities).
Border colors are documented on the [border utilities page](../..//utilities/borders#border-width-style-and-color-utilities).

View File

@ -576,7 +576,7 @@ Use these classes to adjust the alignment of an individual flex item on the cros
## Responsive flex utilities
All flexbox utilities can be adjust per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formulas:
All flexbox utilities can be adjust per [breakpoint](../../objects/grid#breakpoints) using the following formulas:
- `d-[breakpoint]-[property]` for `display`
- `flex-[breakpoint]-[property]-[behavior]` for various flex properties

View File

@ -31,7 +31,7 @@ Adjust the display of an element with `.d-block`, `.d-none`, `.d-inline`, `.d-in
</div>
```
There are known issues with using `display:table` and wrapping long strings, particularly in Firefox. You may need to use `table-fixed` on elements with `d-table` and apply column widths to table cells, which you can do with our [column width styles](/styleguide/css/modules/grid#column-widths).
There are known issues with using `display:table` and wrapping long strings, particularly in Firefox. You may need to use `table-fixed` on elements with `d-table` and apply column widths to table cells, which you can do with our [column width styles](../../objects/grid#column-widths).
```html
<div class="d-table table-fixed width-full">
@ -45,7 +45,7 @@ There are known issues with using `display:table` and wrapping long strings, par
```
### Responsive display
A selection of display utilities are able to be applied or changed per [breakpoint](/styleguide/css/modules/grid#breakpoints). `.d-block`, `.d-none`, `.d-inline`, and `.d-inline-block` are available as responsive utilities using the following formula: `d-[breakpoint]-[property]`. For example: `d-md-inline-block`. Each responsive display utility is applied to the specified breakpoint and up.
A selection of display utilities are able to be applied or changed per [breakpoint](../../objects/grid#breakpoints). `.d-block`, `.d-none`, `.d-inline`, and `.d-inline-block` are available as responsive utilities using the following formula: `d-[breakpoint]-[property]`. For example: `d-md-inline-block`. Each responsive display utility is applied to the specified breakpoint and up.
In the following example, the `ul` element switches from `display: block` on mobile to `display: inline-block` at the `md` breakpoint, while the list items remain inline.
@ -97,7 +97,7 @@ Use `.float-left` and `.float-right` to set floats, and `.clearfix` to clear.
</div>
```
### Responsive floats
Float utilities can be applied or changed per [breakpoint](/styleguide/css/modules/grid#breakpoints). This can be useful for responsive layouts when you want an element to be full width on mobile but floated at a larger breakpoint.
Float utilities can be applied or changed per [breakpoint](../../objects/grid#breakpoints). This can be useful for responsive layouts when you want an element to be full width on mobile but floated at a larger breakpoint.
Each responsive float utility is applied to the specified breakpoint and up, using the following formula: `float-[breakpoint]-[property]`. For example: `float-md-left`. Remember to use `.clearfix` to clear.

View File

@ -3,7 +3,7 @@ title: Margin
status: Stable
---
Margin utilities are based on a global [spacing scale](/styleguide/css/styles/core/support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that share the same properties, and allows to achieve many different page layouts using the same styles.
Margin utilities are based on a global [spacing scale](../../support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that share the same properties, and allows to achieve many different page layouts using the same styles.
{:toc}
@ -103,7 +103,7 @@ Reset margins built into typography elements or other components with `m-0`, `mt
## Responsive margins
All margin utilities, except `mx-auto`, can be adjusted per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formula: `m[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
All margin utilities, except `mx-auto`, can be adjusted per [breakpoint](../../objects/grid#breakpoints) using the following formula: `m[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
```html
<div class="d-inline-block margin-orange">

View File

@ -3,7 +3,7 @@ title: Padding
status: Stable
---
Padding utilities are based on a global [spacing scale](/styleguide/css/styles/core/support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that could share the same properties, and allows to achieve many different page layouts using the same styles.
Padding utilities are based on a global [spacing scale](../../support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that could share the same properties, and allows to achieve many different page layouts using the same styles.
{:toc}
@ -85,7 +85,7 @@ Use directional utilities to apply padding to an individual side, or the X and Y
## Responsive padding
All padding utilities can be adjusted per [breakpoint](/styleguide/css/styles/core/support/breakpoints) using the following formula: <br /> `p-[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
All padding utilities can be adjusted per [breakpoint](../../support/breakpoints) using the following formula: <br /> `p-[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
```html
<div class="px-sm-2 px-lg-4 d-inline-block padding-green">
@ -99,7 +99,7 @@ All padding utilities can be adjusted per [breakpoint](/styleguide/css/styles/co
`.p-responsive` is a padding class that adds padding on the left and right sides of an element. On small screens, it gives the element padding of `$spacer-3`, on mid-sized screens it gives the element padding of `$spacer-6`, and on large screens, it gives the element padding of `$spacer-3`.
It is intended to be used with [container styles](/styleguide/css/styles/core/objects/grid#containers)
It is intended to be used with [container styles](../../objects/grid#containers)
```html
<div class="container-lg p-responsive">

View File

@ -3,11 +3,11 @@ title: Typography
status: Stable
---
Type utilities are designed to work in combination with line-height utilities so as to result in more sensible numbers wherever possible. These also exist as [variables](/styleguide/css/styles/core/support/typography#typography-variables) that you can use in components or custom CSS.
Type utilities are designed to work in combination with line-height utilities so as to result in more sensible numbers wherever possible. These also exist as [variables](/primer/support/typography/#typography-variables) that you can use in components or custom CSS.
{:toc}
Font sizes are smaller on mobile and scale up at the `md` [breakpoint](/styleguide/css/styles/core/support/breakpoints) to be larger on desktop.
Font sizes are smaller on mobile and scale up at the `md` [breakpoint](/primer/support/breakpoints) to be larger on desktop.
| Scale | Font size: mobile | Font size: desktop | 1.25 line height | 1.5 line height |
| --- | --- | --- | --- | --- |