File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 ButtonPrimary ,
1313 ButtonOutline ,
1414 ButtonLink ,
15+ BranchName ,
1516 CounterLabel ,
1617 Heading ,
1718 Label ,
@@ -67,6 +68,15 @@ const Index = props => (
6768 < Example name = 'Box' >
6869 < Box p = { 3 } bg = 'gray.1' > Box </ Box >
6970 </ Example >
71+ < Example name = 'BranchName' >
72+ < BranchName > a_new_feature_branch</ BranchName >
73+ < Detail >
74+ < Heading tag = 'h3' fontSize = { 3 } mb = { 2 } mt = { 3 } > Linked BranchName</ Heading >
75+ < BranchName tag = 'a' href = '/' > a_new_feature_branch</ BranchName >
76+ < Heading tag = 'h3' fontSize = { 3 } mb = { 2 } mt = { 3 } > BranchName with Octicon</ Heading >
77+ < BranchName > < Octicon name = 'git-branch' /> a_new_feature_branch</ BranchName >
78+ </ Detail >
79+ </ Example >
7080 < Example name = 'Button' >
7181 < Button > Button </ Button >
7282 </ Example >
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ const BranchName = ( { children, href, tag } ) => {
4+
5+ const Tag = tag === 'a' ? 'a' : 'span'
6+
7+ // We don't want someone to use href on a non tag
8+ if ( tag != 'a' ) {
9+ href = null
10+ }
11+
12+ return < Tag
13+ href = { href }
14+ className = 'branch-name' >
15+ { children }
16+ </ Tag >
17+ }
18+
19+ export default BranchName
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export { default as ButtonLink } from './ButtonLink'
1717
1818export { default as Heading } from './Heading'
1919export { default as Label } from './Label'
20+ export { default as BranchName } from './BranchName'
2021export { default as Link } from './Link'
2122export { default as Text } from './Text'
2223export { default as Tooltip } from './Tooltip'
You can’t perform that action at this time.
0 commit comments