Skip to content

Commit 6f5ec0d

Browse files
author
Emily
authored
Merge pull request #67 from primer/release-0.0.4-beta
Beta Release 0.0.4
2 parents 8ef1b4e + 9762496 commit 6f5ec0d

File tree

23 files changed

+493
-125
lines changed

23 files changed

+493
-125
lines changed

docs/MergeActions/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Compositor x0"><title>primer-react</title><style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style></head><div id="root"><div style="border-bottom-left-radius:3px;border-bottom-right-radius:3px" class="py-3 px-4 bg-gray-light"><div class="BtnGroup"><button style="border-right:0" type="button" class="btn BtnGroup-item">Merge Pull Request</button><details class="details-reset details-reset d-flex float-right"><summary style="border-top-left-radius:0;border-bottom-left-radius:0" type="button" class="btn"><div class="d-inline-block v-align-middle" style="content:;border:4px solid;border-right-color:transparent;border-left-color:transparent;border-bottom-color:transparent;width:0;height:0"></div></summary><div style="z-index:99999;width:300px" class="mt-1 position-absolute"><div class="rounded-1 position-relative bg-white border"><ul class="list-style-none p-0 m-0"><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Create a merge commit</p><p class="m-0 f6">All commits from this branch will be added to the base branch via a merge commit.</p></li><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Squash and merge</p><p class="m-0 f6">The<!-- --> from this branch will be combined into one commit in the base branch.</p></li><li class="py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Rebase and merge</p><p class="m-0 f6">The<!-- --> from this branch will be rebased and added to the base branch</p></li></ul><svg width="16" height="16" style="pointer-events:none;position:absolute;bottom:100%;left:8px"><g transform="translate(8,16) rotate(180)"><path d="M-8,0L0,8L8,0L-8,0Z" fill="#fff"></path><path d="M-8,0L0,8L8,0" fill="none" stroke="#e1e4e8" stroke-width="1"></path></g></svg></div></div></details></div><span class="ml-2">You can also </span><a class="text-blue no-underline" href="x-github-client://openRepo/undefined?branch=undefined">open this in Github Desktop</a><span> or view </span><button type="button" class="btn-link">command line instructions.</button></div></div><script src="/primer-react/bundle.js"></script>

docs/MergeBox/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Compositor x0"><title>primer-react</title><style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style></head><div id="root"><div class="d-flex flex-items-start"><span class="State"><span class="d-flex m-1"><svg version="1.1" width="24" height="32" viewBox="0 0 12 16" aria-hidden="true" style="display:inline-block;fill:currentColor;vertical-align:text-bottom;user-select:none"><g><path fill-rule="evenodd" d="M10 7.01c-.73 0-1.38.41-1.73 1.02v-.02C7.22 7.99 6 7.65 5.14 6.99c-.75-.58-1.5-1.61-1.89-2.44A1.993 1.993 0 0 0 2 1C.89 1 0 1.9 0 3.01a2 2 0 0 0 1 1.72v6.56c-.59.35-1 .99-1 1.72 0 1.11.89 2 2 2a1.993 1.993 0 0 0 1-3.72V7.68c.67.7 1.44 1.27 2.3 1.69.86.42 2.03.63 2.97.64v-.02c.36.61 1 1.02 1.73 1.02 1.11 0 2-.89 2-2 0-1.11-.89-2-2-2zm-6.8 6c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.21c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm8 6c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></g></svg></span></span><div class="ml-3 rounded-1 position-relative bg-white border border-undefined"><div class="p-2 d-flex border-bottom"><div class="mt-2"><div style="width:32px;height:32px" class="circle d-flex flex-items-center flex-justify-center text-white"><svg version="1.1" width="12" height="16" viewBox="0 0 12 16" aria-hidden="true" style="display:inline-block;fill:currentColor;vertical-align:text-bottom;user-select:none"><g><path fill-rule="evenodd" d="M12 5.5l-8 8-4-4L1.5 8 4 10.5 10.5 4 12 5.5z"></path></g></svg></div></div><div class="p-2 d-inline"><p class="p-0 m-0 f4 text-bold">This branch has no conflicts with the base branch</p><p class="pt-1 m-0 f6">Merging can be performed automatically</p></div></div><div style="border-bottom-left-radius:3px;border-bottom-right-radius:3px" class="py-3 px-4 bg-gray-light"><div class="BtnGroup"><button style="border-right:0" type="button" class="btn BtnGroup-item">Merge Pull Request</button><details class="details-reset details-reset d-flex float-right"><summary style="border-top-left-radius:0;border-bottom-left-radius:0" type="button" class="btn"><div class="d-inline-block v-align-middle" style="content:;border:4px solid;border-right-color:transparent;border-left-color:transparent;border-bottom-color:transparent;width:0;height:0"></div></summary><div style="z-index:99999;width:300px" class="mt-1 position-absolute"><div class="rounded-1 position-relative bg-white border"><ul class="list-style-none p-0 m-0"><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Create a merge commit</p><p class="m-0 f6">All commits from this branch will be added to the base branch via a merge commit.</p></li><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Squash and merge</p><p class="m-0 f6">The<!-- --> from this branch will be combined into one commit in the base branch.</p></li><li class="py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Rebase and merge</p><p class="m-0 f6">The<!-- --> from this branch will be rebased and added to the base branch</p></li></ul><svg width="16" height="16" style="pointer-events:none;position:absolute;bottom:100%;left:8px"><g transform="translate(8,16) rotate(180)"><path d="M-8,0L0,8L8,0L-8,0Z" fill="#fff"></path><path d="M-8,0L0,8L8,0" fill="none" stroke="#e1e4e8" stroke-width="1"></path></g></svg></div></div></details></div><span class="ml-2">You can also </span><a class="text-blue no-underline" href="x-github-client://openRepo/undefined?branch=undefined">open this in Github Desktop</a><span> or view </span><button type="button" class="btn-link">command line instructions.</button></div><svg width="16" height="16" style="pointer-events:none;position:absolute;right:100%;top:8px"><g transform="translate(16,8) rotate(90)"><path d="M-8,0L0,8L8,0L-8,0Z" fill="#fff"></path><path d="M-8,0L0,8L8,0" fill="none" stroke="#e1e4e8" stroke-width="1"></path></g></svg></div></div></div><script src="/primer-react/bundle.js"></script>

docs/MergeButton/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Compositor x0"><title>primer-react</title><style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style></head><div id="root"><div class="BtnGroup"><button style="border-right:0" type="button" class="btn BtnGroup-item">Merge Pull Request</button><details class="details-reset details-reset d-flex float-right"><summary style="border-top-left-radius:0;border-bottom-left-radius:0" type="button" class="btn"><div class="d-inline-block v-align-middle" style="content:;border:4px solid;border-right-color:transparent;border-left-color:transparent;border-bottom-color:transparent;width:0;height:0"></div></summary><div style="z-index:99999;width:300px" class="mt-1 position-absolute"><div class="rounded-1 position-relative bg-white border"><ul class="list-style-none p-0 m-0"><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Create a merge commit</p><p class="m-0 f6">All commits from this branch will be added to the base branch via a merge commit.</p></li><li class="border-bottom py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Squash and merge</p><p class="m-0 f6">The<!-- --> from this branch will be combined into one commit in the base branch.</p></li><li class="py-2 pl-4 pr-2"><p class="m-0 f5 text-bold">Rebase and merge</p><p class="m-0 f6">The<!-- --> from this branch will be rebased and added to the base branch</p></li></ul><svg width="16" height="16" style="pointer-events:none;position:absolute;bottom:100%;left:8px"><g transform="translate(8,16) rotate(180)"><path d="M-8,0L0,8L8,0L-8,0Z" fill="#fff"></path><path d="M-8,0L0,8L8,0" fill="none" stroke="#e1e4e8" stroke-width="1"></path></g></svg></div></div></details></div></div><script src="/primer-react/bundle.js"></script>

docs/MergeDetail/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Compositor x0"><title>primer-react</title><style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style></head><div id="root"><div class="p-2 d-flex border-bottom"><div class="mt-2"><div style="width:32px;height:32px" class="circle d-flex flex-items-center flex-justify-center text-white"><svg version="1.1" width="12" height="16" viewBox="0 0 12 16" aria-hidden="true" style="display:inline-block;fill:currentColor;vertical-align:text-bottom;user-select:none"><g><path fill-rule="evenodd" d="M12 5.5l-8 8-4-4L1.5 8 4 10.5 10.5 4 12 5.5z"></path></g></svg></div></div><div class="p-2 d-inline"><p class="p-0 m-0 f4 text-bold">This branch has no conflicts with the base branch</p><p class="pt-1 m-0 f6">Merging can be performed automatically</p></div></div></div><script src="/primer-react/bundle.js"></script>

docs/bundle.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

examples/MergeActions.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import CircleOcticon from '../src/CircleOcticon'
4+
import Text from '../src/Text'
5+
import Block from '../src/Block'
6+
import Link from '../src/Link'
7+
import ButtonLink from '../src/ButtonLink'
8+
import MergeButton from './MergeButton'
9+
10+
const MergeActions = ({ numCommits, repoUrl, branchName, state }) => {
11+
return (
12+
<Block py={3} px={4} bg='gray-light' style={{borderBottomLeftRadius: '3px', borderBottomRightRadius: '3px'}}>
13+
<MergeButton primary={state === 'ready'} numCommits={numCommits} />
14+
<Text ml={2}>You can also </Text>
15+
<Link nounderline href={`x-github-client://openRepo/${repoUrl}?branch=${branchName}`}>open this in Github Desktop</Link>
16+
<Text> or view </Text>
17+
<ButtonLink>command line instructions.</ButtonLink>
18+
</Block>
19+
)
20+
}
21+
22+
MergeActions.propTypes = {
23+
numCommits: PropTypes.number.isRequired,
24+
repoUrl: PropTypes.string.isRequired,
25+
branchName: PropTypes.string.isRequired,
26+
}
27+
28+
export default MergeActions

examples/MergeBox.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import MergeStatus from '../src/MergeStatus'
4+
import CaretBox from '../src/CaretBox'
5+
import MergeButton from './MergeButton'
6+
import MergeDetail from './MergeDetail'
7+
import MergeActions from './MergeActions'
8+
9+
const stateColorMap = {
10+
ready: 'green',
11+
invalid: 'invalid',
12+
merged: 'purple',
13+
pending: 'yellow'
14+
}
15+
16+
const MergeBox = ({ state, repoUrl, branchName, numCommits }) => {
17+
return (
18+
<div className='d-flex flex-items-start'>
19+
<MergeStatus state={state}/>
20+
<CaretBox ml={3} border={[true, stateColorMap[state]]} caret='left-top'>
21+
<MergeDetail state={state}/>
22+
<MergeActions state={state} numCommits={numCommits} repoUrl={repoUrl} branchName={branchName} />
23+
</CaretBox>
24+
</div>
25+
)
26+
}
27+
28+
MergeBox.propTypes = {
29+
state: PropTypes.oneOf(['ready', 'invalid', 'merged', 'pending']).isRequired,
30+
repoUrl: PropTypes.string.isRequired,
31+
branchName: PropTypes.string.isRequired,
32+
numCommits: PropTypes.number.isRequired
33+
}
34+
35+
export default MergeBox

examples/MergeButton.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import Details from '../src/Details'
4+
import Button from '../src/Button'
5+
import CaretBox from '../src/CaretBox'
6+
import Text from '../src/Text'
7+
import Block from '../src/Block'
8+
9+
const MergeButton = ({ primary, onClick, numCommits, children}) => {
10+
const arrowStyles = {
11+
content: '',
12+
border: '4px solid',
13+
borderRightColor: 'transparent',
14+
borderLeftColor: 'transparent',
15+
borderBottomColor: 'transparent',
16+
width: '0',
17+
height: '0'
18+
}
19+
20+
const borderStyles = {
21+
borderTopLeftRadius: '0',
22+
borderBottomLeftRadius: '0'
23+
}
24+
25+
const buttonSchemeProps = {}
26+
if (primary) {
27+
buttonSchemeProps.scheme = 'primary'
28+
}
29+
30+
return(
31+
<div className='BtnGroup'>
32+
<Button {...buttonSchemeProps} grouped onClick={onClick} style={{ borderRight: 0}}>
33+
Merge Pull Request
34+
</Button>
35+
<Details className='details-reset d-flex float-right'>
36+
{({open, toggle}) => (
37+
<React.Fragment>
38+
<Button tag='summary' {...buttonSchemeProps} onClick={toggle} style={borderStyles}>
39+
<div className='d-inline-block v-align-middle' style={arrowStyles}/>
40+
</Button>
41+
<Block position='absolute' width={300} mt={1} style={{zIndex: 99999}}>
42+
<CaretBox caret='top-left'>
43+
<ul className='list-style-none p-0 m-0'>
44+
<li className='border-bottom py-2 pl-4 pr-2'>
45+
<Text tag='p' m={0} fontSize={1} fontWeight='bold'>Create a merge commit</Text>
46+
<Text tag='p' m={0} fontSize={0}>All commits from this branch will be added to the base branch via a merge commit.</Text>
47+
</li>
48+
<li className='border-bottom py-2 pl-4 pr-2'>
49+
<Text tag='p' m={0} fontSize={1} fontWeight='bold'>Squash and merge</Text>
50+
<Text tag='p' m={0} fontSize={0}>The {numCommits} from this branch will be combined into one commit in the base branch.</Text>
51+
</li>
52+
<li className='py-2 pl-4 pr-2'>
53+
<Text tag='p' m={0} fontSize={1} fontWeight='bold'>Rebase and merge</Text>
54+
<Text tag='p' fontSize={0} m={0}>The {numCommits} from this branch will be rebased and added to the base branch</Text>
55+
</li>
56+
</ul>
57+
</CaretBox>
58+
</Block>
59+
</React.Fragment>
60+
)}
61+
</Details>
62+
</div>
63+
)
64+
}
65+
66+
MergeButton.propTypes = {
67+
primary: PropTypes.bool,
68+
onClick: PropTypes.func.isRequired,
69+
numCommits: PropTypes.number.isRequired,
70+
}
71+
72+
export default MergeButton

examples/MergeDetail.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import CircleOcticon from '../src/CircleOcticon'
4+
import Text from '../src/Text'
5+
import Block from '../src/Block'
6+
7+
const stateColorMap = {
8+
ready: 'green',
9+
invalid: 'invalid',
10+
merged: 'purple',
11+
pending: 'yellow'
12+
}
13+
14+
const MergeDetail = ({ state }) => {
15+
return (
16+
<div className='p-2 d-flex border-bottom'>
17+
<Block mt={2}>
18+
<CircleOcticon name='check' size={32} bg={stateColorMap[state]} color='white'/>
19+
</Block>
20+
<Block p={2} display='inline'>
21+
<Text tag='p' p={0} m={0} fontSize={2} fontWeight='bold'>This branch has no conflicts with the base branch</Text>
22+
<Text tag='p' pt={1} m={0} fontSize={0}>Merging can be performed automatically</Text>
23+
</Block>
24+
</div>
25+
)
26+
}
27+
28+
MergeDetail.propTypes = {
29+
state: PropTypes.oneOf(['ready', 'invalid', 'merged', 'pending']).isRequired,
30+
}
31+
32+
export default MergeDetail

0 commit comments

Comments
 (0)