Skip to content

Commit 06feed4

Browse files
authored
Merge branch 'release-10.0.0' into popover
2 parents 15d89f3 + fd80450 commit 06feed4

File tree

43 files changed

+604
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+604
-312
lines changed

.storybook/Octicon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
22
import {storiesOf} from '@storybook/react'
33
import octicons from 'octicons'
4-
import SVGInline from 'react-svg-inline'
54

6-
const Octicon = (props) => {
5+
export const Octicon = (props) => {
76
const {name} = props
87
if (name in octicons) {
9-
return <SVGInline svg={octicons[name].toSVG(props)} />
8+
const svg = octicons[name].toSVG(props)
9+
return <span dangerouslySetInnerHTML={ {__html: svg } } />
1010
} else {
1111
throw new Error(`No such octicon: "${name}"!`)
1212
}

.storybook/lib/storiesFromMarkdown.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,23 @@ import select from 'unist-util-select'
44
import findBefore from 'unist-util-find-before'
55
import htmlToReact from 'html-to-react'
66
import parsePairs from 'parse-pairs'
7+
import React from 'react'
8+
import ReactDOMServer from 'react-dom/server'
9+
import {Octicon} from '../Octicon'
710

811
const htmlParser = new htmlToReact.Parser()
912

13+
const railsOcticonToReact = (html) => {
14+
// <%= octicon "tools" %> to <Octicon name="tools" />
15+
const octre = /<%= octicon ["']([a-z\-]+)["'][^%]*%>/gi
16+
html = html.replace(octre, (match, name) => {
17+
return ReactDOMServer.renderToStaticMarkup(<Octicon name={name} />)
18+
})
19+
return html
20+
}
21+
1022
const nodeToStory = (node, file) => {
11-
const html = node.value
23+
const html = railsOcticonToReact(node.value)
1224
const element = htmlParser.parse(html)
1325
const pairs = node.lang.replace(/^html\s*/, '')
1426
const attrs = pairs.length ? parsePairs(pairs) : {}

.storybook/preview-head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<link rel="stylesheet" href="https://unpkg.com/primer-css@9.2.0/build/build.css">
1+
<link rel="stylesheet" href="https://unpkg.com/octicons@7.0.1/build/build.css">
22
<script src="https://github.com/site/assets/styleguide.js" async></script>

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# 10.0.0
2+
3+
### Added
4+
- New module `primer-subhead`. The Subhead is a simple header with a bottom border. It&#39;s designed to be used on settings and configuration pages.
5+
- Importing `.input-group` into `primer-forms` module.
6+
- New module `primer-branch-name` "A nice, consistent way to display branch names."
7+
8+
### Removed
9+
- Removing `primer-cards` module.
10+
- Removing `.form-cards` styles.
11+
12+
### Changes
13+
- Moving `primer-breadcrumb` from `primer-marketing` to `primer-core`
14+
115
# 9.6.0
216

317
### Added

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 GitHub Inc.
3+
Copyright (c) 2017 GitHub Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
File renamed without changes.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Primer CSS / Branch Name
2+
3+
[![npm version](http://img.shields.io/npm/v/primer-branch-name.svg)](https://www.npmjs.org/package/primer-branch-name)
4+
[![Build Status](https://travis-ci.org/primer/primer-css.svg?branch=master)](https://travis-ci.org/primer/primer-css)
5+
6+
> A nice, consistent way to display branch names.
7+
8+
This repository is a module of the full [primer-css][primer-css] repository.
9+
10+
## Install
11+
12+
This repository is distributed with [npm]. After [installing npm][install-npm], you can install `primer-branch-name` with this command.
13+
14+
```
15+
$ npm install --save primer-branch-name
16+
```
17+
18+
## Usage
19+
20+
The source files included are written in [Sass][sass] (SCSS) You can simply point your sass `include-path` at your `node_modules` directory and import it like this.
21+
22+
```scss
23+
@import "primer-branch-name/index.scss";
24+
```
25+
26+
You can also import specific portions of the module by importing those partials from the `/lib/` folder. _Make sure you import any requirements along with the modules._
27+
28+
## Build
29+
30+
For a compiled **CSS** version of this module, an npm script is included that will output a css version to `build/build.css` The built css file is also included in the npm package:
31+
32+
```
33+
$ npm run build
34+
```
35+
36+
## Documentation
37+
38+
<!-- %docs
39+
title: Branch name
40+
status: Stable
41+
-->
42+
43+
Branch names can be a link name or not:
44+
45+
```html
46+
<span class="branch-name">a_new_feature_branch</span>
47+
<a href="#url" class="branch-name">a_new_feature_branch</a>
48+
```
49+
50+
You may also include an octicon before the branch name text:
51+
52+
```html
53+
<span class="branch-name">
54+
<%= octicon("git-branch") width:16 height:16 %>
55+
a_new_feature_branch
56+
</span>
57+
```
58+
59+
<!-- %enddocs -->
60+
61+
## License
62+
63+
[MIT](./LICENSE) &copy; [GitHub](https://github.com/)
64+
65+
[primer-css]: https://github.com/primer/primer
66+
[docs]: http://primercss.io/
67+
[npm]: https://www.npmjs.com/
68+
[install-npm]: https://docs.npmjs.com/getting-started/installing-node
69+
[sass]: http://sass-lang.com/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// support files
2+
@import "primer-support/index.scss";
3+
@import "./lib/branch-name.scss";
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// A nice way to display branch names inside the UI. Can be a link or not.
2+
// stylelint-disable selector-max-type
3+
.branch-name {
4+
display: inline-block;
5+
padding: 2px 6px;
6+
font: 12px $mono-font;
7+
color: rgba($black, 0.6);
8+
background-color: lighten($blue-100, 3%);
9+
border-radius: 3px;
10+
11+
.octicon {
12+
margin: 1px -2px 0 0;
13+
color: desaturate($blue-300, 70%);
14+
}
15+
}
16+
17+
// When a branch name is a link
18+
// stylelint-disable selector-no-qualifying-type
19+
a.branch-name { color: $text-blue; }
20+
// stylelint-enable selector-no-qualifying-type
Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
11
{
2-
"version": "0.5.1",
3-
"name": "primer-cards",
4-
"description": "Card-like containers to group semantically related content together on marketing websites at GitHub.",
2+
"version": "0.0.1",
3+
"name": "primer-branch-name",
4+
"description": "A nice, consistent way to display branch names.",
55
"homepage": "http://primercss.io/",
6-
"author": "GitHub, Inc.",
7-
"license": "MIT",
8-
"style": "build/build.css",
9-
"main": "build/index.js",
106
"primer": {
11-
"category": "marketing",
7+
"category": "product",
128
"module_type": "components"
139
},
14-
"files": [
15-
"index.scss",
16-
"lib",
17-
"build"
18-
],
19-
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-cards",
10+
"author": "GitHub, Inc.",
11+
"license": "MIT",
12+
"style": "index.scss",
13+
"main": "build/index.js",
14+
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-branch-name",
2015
"bugs": {
2116
"url": "https://github.com/primer/primer-css/issues"
2217
},
2318
"scripts": {
19+
"test-docs": "../../script/test-docs",
2420
"build": "../../script/npm-run primer-module-build index.scss",
2521
"prepare": "npm run build",
2622
"lint": "../../script/lint-scss",
27-
"test": "../../script/npm-run-all build lint"
23+
"test": "../../script/npm-run-all build lint test-docs"
2824
},
2925
"dependencies": {
30-
"primer-marketing-support": "1.3.1",
3126
"primer-support": "4.4.1"
3227
},
3328
"keywords": [
34-
"cards",
35-
"css",
3629
"github",
37-
"primer",
38-
"primercss",
39-
"style"
30+
"primer"
4031
]
4132
}

0 commit comments

Comments
 (0)