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

Release 13.2.0 #954

Merged
merged 52 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8a3a8a9
update development docs for new gatsby site
Sep 13, 2019
599ecfd
Importing TimelineItem from .com and creating matching docs
jonrohan Sep 26, 2019
2133d45
Including support files
jonrohan Sep 26, 2019
ef33df5
Update src/timeline/timeline-item.scss
jonrohan Oct 10, 2019
cb4f7d2
Convert to html example
simurai Oct 11, 2019
28f22d4
Fix example styling
simurai Oct 11, 2019
84e391a
Remove note
simurai Oct 11, 2019
331f25b
Fix broken links to typography utilities
MohamedElidrissi Oct 14, 2019
3560f36
add [role=tab][aria-selected=true] to .UnderlineNav-item.selected
shawnbot Oct 14, 2019
74426ab
Add `diffstat` styles from dotcom
simurai Oct 21, 2019
147ed5e
Add documentation
simurai Oct 21, 2019
36334a1
Lint
simurai Oct 21, 2019
c9ba917
Wait to update the "added" color
simurai Oct 21, 2019
95c6a02
Add IssueLabel from dotcom
simurai Oct 22, 2019
6cfb61f
Add documentation
simurai Oct 22, 2019
9a9483b
Remove disables
simurai Oct 22, 2019
8b9b7cb
add .UnderlineNav-item[aria-current] to selected state
shawnbot Oct 22, 2019
a87823b
npm version minor
shawnbot Oct 22, 2019
b8a0078
add chroma-js, postcss-import, postcss-value-parser
shawnbot Oct 18, 2019
7f0cca8
add script/analyze-variables.js
shawnbot Oct 18, 2019
771a9f3
output variable analysis to meta/variables.json in dist
shawnbot Oct 18, 2019
ce034c2
remove chroma-js from top-level package.json
shawnbot Oct 18, 2019
99c223e
lint
shawnbot Oct 22, 2019
d65b411
Update src/labels/diffstat.scss
simurai Oct 23, 2019
ff8e78f
Use aliases for the colors
simurai Oct 23, 2019
74d0495
Import timeline bundle into product
simurai Oct 23, 2019
dacbd10
Merge pull request #943 from MohamedElidrissi/patch-1
shawnbot Oct 23, 2019
645f630
Merge pull request #939 from primer/box-overlay-example
shawnbot Oct 23, 2019
cac447a
Merge pull request #949 from primer/variable-inspector
shawnbot Oct 23, 2019
08fe118
add TODO(version) tests
shawnbot Oct 14, 2019
ceb67a3
chore: lint
shawnbot Oct 14, 2019
976ad8a
delete script/test-todos.js (managed via stylelint)
shawnbot Oct 22, 2019
e6e68e4
Merge pull request #897 from primer/update-docs
shawnbot Oct 23, 2019
7df15de
Merge pull request #946 from primer/test-todos
shawnbot Oct 23, 2019
435abad
Merge pull request #953 from primer/issue-label
shawnbot Oct 23, 2019
3f8775b
Merge pull request #913 from primer/timelineitem
shawnbot Oct 23, 2019
6013909
Move .details-reset
simurai Oct 24, 2019
4de9650
Fix spacing between buttons
simurai Oct 24, 2019
efbed68
Move some of the exotic buttons to /misc
simurai Oct 24, 2019
f61a726
Remove <p>
simurai Oct 24, 2019
0e55872
Add .close-button
simurai Oct 24, 2019
db6d65c
Add invisible button
simurai Oct 24, 2019
d34dd03
Add Octicon button
simurai Oct 24, 2019
1875246
Update comment
simurai Oct 24, 2019
d9d40d9
Lint
simurai Oct 24, 2019
2e5a64c
Lint
simurai Oct 24, 2019
1d150d4
move $bg-diffstat-* variables to colors.scss
shawnbot Oct 24, 2019
f16ae5e
nix :not([aria-current=false]) from UnderlineNav-item selected selector
shawnbot Oct 24, 2019
d0ae4a6
Merge pull request #950 from primer/diffstat
simurai Oct 25, 2019
036ed32
Merge pull request #945 from primer/underline-nav-tab-container
simurai Oct 25, 2019
3100ca3
Merge pull request #959 from primer/buttons
simurai Oct 25, 2019
5eacec8
chore: update changelog for v13.2.0
shawnbot Oct 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# 13.2.0

### :rocket: Enhancements
- [#959](https://github.com/primer/css/959) More buttons
- [#950](https://github.com/primer/css/950) Add Diffstat component
- [#913](https://github.com/primer/css/913) Importing TimelineItem from .com and creating matching docs
- [#953](https://github.com/primer/css/953) Add IssueLabel component

### :bug: Bug fixes
- [#945](https://github.com/primer/css/945) Add `[role=tab][aria-selected=true]` to `.UnderlineNav-item.selected`

### :memo: Documentation
- [#939](https://github.com/primer/css/939) Fix `Box--overlay` example
- [#943](https://github.com/primer/css/943) Fix broken links to typography utilities

### :house: Internal
- [#946](https://github.com/primer/css/946) Add `TODO@version` stylelint rule (local)

### Committers
- [@MohamedElidrissi](https://github.com/MohamedElidrissi)
- [@jonrohan](https://github.com/jonrohan)
- [@shawnbot](https://github.com/shawnbot)
- [@simurai](https://github.com/simurai)

# 13.1.0

### :rocket: Enhancement
Expand Down
10 changes: 4 additions & 6 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@ The typical Primer workflow looks something like this:
Run `npm install` to install the npm dependencies.

## Docs site
The Primer CSS docs are built with React using [Primer Components](https://primer.style/components) and automatically deployed on every push to this repo with [Now]. You can run the server locally with:
The Primer CSS docs are built with React using [Doctocat](https://primer.style/doctocat) and automatically deployed on every push to this repo with [Now]. You can run the server locally with:

```sh
npm start
```

Then visit http://localhost:3000/css to view the site.
Then visit http://localhost:8000 to view the site.

:rotating_light: **Warning:** Next.js has a [long-running issue](https://github.com/zeit/next.js/issues/1189) with trailing slashes in URLs. Avoid visiting `http://localhost:3000/` if possible, as this may cause your development server to fail in less-than-graceful ways.

### The pages directory
The [pages directory](./pages/) contains all of the documentation files that map to URLs on the site. Because we host the site at `primer.style/css` (and because of the way that Now's path aliasing feature works), we nest all of our documentation under the [css subdirectory](./pages/css).
### The docs directory
The [docs directory](./docs/) contains all of the documentation files in our docs site. Files are nested in the `/content` folder.


### URL tests
Expand Down
10 changes: 7 additions & 3 deletions docs/content/components/box-overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Use the `Box--overlay` with the `<details>` and [`<details-dialog>`](https://git

Box overlays come in three widths. The default `Box--overlay` is 440px wide, `Box-overlay--narrow` is 320px wide, and `Box-overlay--wide` is 640px wide.

**Note:** `position: fixed` has been disabled in this example
```html live

```erb
<details class="details-reset details-overlay details-overlay-dark">
<summary class="btn" aria-haspopup="dialog">Open dialog</summary>
<details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast">
<div class="Box-header">
<button class="Box-btn-octicon btn-octicon float-right" type="button" aria-label="Close dialog" data-close-dialog>
<%= octicon "x" %>
<!-- <%= octicon "x" %> -->
<svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg>
</button>
<h3 class="Box-title">Box title</h3>
</div>
Expand Down Expand Up @@ -50,6 +50,10 @@ Box overlays come in three widths. The default `Box--overlay` is 440px wide, `Bo
</div>
</details-dialog>
</details>

<!-- Temporary overrides (don't use in production) -->
<style> .frame-example { min-height: 500px; } </style>
<link href="https://unpkg.com/@github/details-dialog-element/index.css" rel="stylesheet" />
```

In github.com there is a shared dialog partial. You will only have to pass in the modal content:
Expand Down
122 changes: 74 additions & 48 deletions docs/content/components/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ Use the standard—yet classy—`.btn` for form actions and primary page actions
When using a `<button>` element, **always specify a `type`**. When using a `<a>` element, **always add `role="button"` for accessibility**.

```html live
<button class="btn" type="button">Button button</button> <a class="btn" href="#url" role="button">Link button</a>
<button class="btn mr-2" type="button">Button button</button>
<a class="btn" href="#url" role="button">Link button</a>
```

You can find them in two sizes: the default `.btn` and the smaller `.btn-sm`.

```html live
<button class="btn" type="button">Button</button> <button class="btn btn-sm" type="button">Small button</button>
<button class="btn mr-2" type="button">Button</button>
<button class="btn btn-sm" type="button">Small button</button>
```

## Primary button

Primary buttons are green and are used to indicate the _primary_ action on a page. When you need your buttons to stand out, use `.btn.btn-primary`. You can use it with both button sizes—just add `.btn-primary`.

```html live
<button class="btn btn-primary" type="button">Primary button</button>
<button class="btn btn-primary mr-2" type="button">Primary button</button>
<button class="btn btn-sm btn-primary" type="button">Small primary button</button>
```

Expand All @@ -38,7 +40,7 @@ Primary buttons are green and are used to indicate the _primary_ action on a pag
Danger buttons are red. They help reiterate that the intended action is important or potentially dangerous (e.g., deleting a repo or transferring ownership). Similar to the primary buttons, just add `.btn-danger`.

```html live
<button class="btn btn-danger" type="button">Danger button</button>
<button class="btn btn-danger mr-2" type="button">Danger button</button>
<button class="btn btn-sm btn-danger" type="button">Small danger button</button>
```

Expand All @@ -47,7 +49,7 @@ Danger buttons are red. They help reiterate that the intended action is importan
Outline buttons downplay an action as they appear like boxy links. Just add `.btn-outline` and go.

```html live
<button class="btn btn-outline" type="button">Outline button</button>
<button class="btn btn-outline mr-2" type="button">Outline button</button>
<button class="btn btn-sm btn-outline" type="button">Outline button</button>
```

Expand All @@ -58,44 +60,42 @@ Use `.btn-large` to increase the padding and border radius of a button. This is
[Type scale utilities](https://styleguide.github.com/primer/utilities/typography/#type-scale-utilities) can be used to alter the font-size if needed. Padding is applied in em's so that it scales proportionally with the font-size.

```html live
<p>
<a class="btn btn-large" href="#url" role="button">Large link button</a>
<button class="btn btn-large" type="button">Large button button</button>
</p>
<button class="btn btn-large mr-2" type="button">Large button</button>
<a class="btn btn-large" href="#url" role="button">Large link button</a>
```

Use `.btn-large` with a type scale utility to transform the text to a bigger size.

```html live
<p class="f3">
<div class="f3">
<button class="btn btn-large btn-outline-blue mr-2" type="button">Large button button</button>
<a class="btn btn-large" href="#url" role="button">Large link button</a>
<button class="btn btn-large btn-outline-blue" type="button">Large button button</button>
</p>
</div>
```

## Disabled state

Disable `<button>` elements with the boolean `disabled` attribute and `<a>` elements with the `.disabled` class.

```html live
<button class="btn" type="button" disabled>Disabled button</button>
<button class="btn mr-2" type="button" disabled>Disabled button</button>
<a class="btn disabled" href="#url" role="button">Disabled button</a>
```

Similar styles are applied to primary, danger, and outline buttons:

```html live
<button class="btn btn-primary" type="button" disabled>Disabled button</button>
<button class="btn btn-primary mr-2" type="button" disabled>Disabled button</button>
<a class="btn btn-primary disabled" href="#url" role="button">Disabled button</a>
```

```html live
<button class="btn btn-danger" type="button" disabled>Disabled button</button>
<button class="btn btn-danger mr-2" type="button" disabled>Disabled button</button>
<a class="btn btn-danger disabled" href="#url" role="button">Disabled button</a>
```

```html live
<button class="btn btn-outline" type="button" disabled>Disabled button</button>
<button class="btn btn-outline mr-2" type="button" disabled>Disabled button</button>
<a class="btn btn-outline disabled" href="#url" role="button">Disabled button</a>
```

Expand All @@ -104,8 +104,8 @@ Similar styles are applied to primary, danger, and outline buttons:
Make any button full-width by adding `.btn-block`. It adds `width: 100%;`, changes the `display` from `inline-block` to `block`, and centers the button text.

```html live
<p><button class="btn btn-block" type="button">Block button</button></p>
<p><button class="btn btn-sm btn-block" type="button">Small block button</button></p>
<button class="btn btn-block mb-2" type="button">Block button</button>
<button class="btn btn-sm btn-block" type="button">Small block button</button>
```

## Link button
Expand All @@ -115,7 +115,55 @@ Create a button that looks like a link with `.btn-link`. Rather than using an `<
**The `.btn-link` class is not designed to be used with `.btn`; the overlapping styles are not compatible.**

```html live
<p><button class="btn-link" type="button">Link button</button></p>
<button class="btn-link" type="button">Link button</button>
```

## Invisible button

When you want a link, but you want it padded and line heighted like a button best for "cancel" actions on forms.

```html live
<button class="btn btn-invisible" type="button">Cancel</button>
<button class="btn" type="button">Submit</button>
```

## Octicon button

Icon-only buttons that turn blue on hover. Use `.btn-octicon-danger` to turn an icon red on hover.

```html live
<button class="btn-octicon" type="button" aria-label="Desktop icon">
<!-- <%= octicon "device-desktop" %> -->
<svg class="octicon octicon-device-desktop" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z"></path></svg>
</button>

<button class="btn-octicon" type="button" aria-label="Pencil icon">
<!-- <%= octicon "pencil" %> -->
<svg class="octicon octicon-pencil" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 011.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"></path></svg>
</button>

<button class="btn-octicon btn-octicon-danger" type="button" aria-label="Trashcan icon">
<!-- <%= octicon "trashcan" %> -->
<svg class="octicon octicon-trashcan" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg>
</button>

<button class="btn-octicon" type="button" aria-label="Trashcan icon">
<!-- <%= octicon "kebab-horizontal" %> -->
<svg class="octicon octicon-kebab-horizontal" viewBox="0 0 13 16" version="1.1" width="13" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm5 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13 7.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"></path></svg>
</button>
```



## Close button

When using the `octicon-x` icon for a close button, add `.close-button` to remove the default button styles.

```html live
<button class="close-button" type="button">
<!-- <%= octicon "x" %> -->
<svg width="12" height="16" viewBox="0 0 12 16" class="octicon octicon-x" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z" /></svg>
</button>
```

## Button with counts
Expand All @@ -138,24 +186,20 @@ You can easily append a count to a **small button**. Add the `.with-count` class
You can also use the [counter](./labels#counters) component within buttons:

```html live
<button class="btn" type="button">
Button
<span class="Counter">12</span>
<button class="btn mr-2" type="button">
Button <span class="Counter">12</span>
</button>

<button class="btn btn-primary" type="button">
Button
<span class="Counter">12</span>
<button class="btn btn-primary mr-2" type="button">
Button <span class="Counter">12</span>
</button>

<button class="btn btn-danger" type="button">
Button
<span class="Counter">12</span>
<button class="btn btn-danger mr-2" type="button">
Button <span class="Counter">12</span>
</button>

<button class="btn btn-outline" type="button">
Button
<span class="Counter">12</span>
Button <span class="Counter">12</span>
</button>
```

Expand Down Expand Up @@ -207,21 +251,3 @@ Use `.hidden-text-expander` to indicate and toggle hidden text.
```

You can also make the expander appear inline by adding `.inline`.

## Using button styles with the details summary element

You can add `.btn` and `.btn-*` classes to any
[`<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary)
element so that it gains the appearance of a button, and
selected/active styles when the parent
[`<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details)
element is open.

```html live
<details>
<summary class="btn btn-block btn-primary">Toggle the content</summary>
<p class="mt-2">
This content will be toggled.
</p>
</details>
```
42 changes: 42 additions & 0 deletions docs/content/components/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ Use `Label--outline-green` in combination with `Label--outline` to communicate a
<span title="Label: green outline label" class="Label Label--outline Label--outline-green">green outlined label</span>
```

## Issue Labels

Issue Labels are used for adding labels to issues and pull requests. They also come with emoji support.

```html live
<span class="IssueLabel bg-blue text-white mr-1" title="Label: good first issue">good first issue</span>
<span class="IssueLabel bg-red text-white mr-1" title="Label: bug">bug 🐛</span>
<span class="IssueLabel bg-green text-white" title="Label: bug">help wanted</span>
```

If an Issue Label needs to be bigger, add the `.IssueLabel--big` modifier.

```html live
<span class="IssueLabel IssueLabel--big bg-blue text-white mr-1" title="Label: good first issue">good first issue</span>
<span class="IssueLabel IssueLabel--big bg-red text-white mr-1" title="Label: bug">bug 🐛</span>
<span class="IssueLabel IssueLabel--big bg-green text-white" title="Label: bug">help wanted</span>
```


## States

Use state labels to inform users of an items status. States are large labels with bolded text. The default state has a gray background.
Expand Down Expand Up @@ -155,3 +174,26 @@ Counters can also be used in `Box` headers to indicate the number of items in a
</ul>
</div>
```

## Diffstat

Diffstats show how many deletions or additions a diff has. It's typically a row of 5 blocks that get colored with green or red.

```html live
<span class="diffstat tooltipped tooltipped-e" aria-label="6 changes: 3 additions &amp; 3 deletions">
6
<span class="diffstat-block-added"></span><span class="diffstat-block-added"></span><span class="diffstat-block-deleted"></span><span class="diffstat-block-deleted"></span><span class="diffstat-block-neutral"></span>
</span>
```

Use the `text-green` and `text-red` utilities to add addtitional information about the size of the diff.

```html live
<span class="diffstat">
<span class="text-green">+7</span>
<span class="text-red">−2</span>
<span class="tooltipped tooltipped-e" aria-label="9 lines changed">
<span class="diffstat-block-added"></span><span class="diffstat-block-added"></span><span class="diffstat-block-added"></span><span class="diffstat-block-deleted"></span><span class="diffstat-block-neutral"></span>
</span>
</span>
```
Loading