Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
94d8777
increase horizontal padding
Feb 19, 2020
65f0de3
update variant padding
Feb 19, 2020
1134433
update Button background color & radius
Feb 19, 2020
3de5548
primary button
Feb 19, 2020
6d4e5de
fix primary border
Feb 19, 2020
46d93a0
refactor theme
Feb 19, 2020
ffffaf1
update danger button
Feb 19, 2020
4b3d70b
revert to default outline styles
Feb 19, 2020
e67d764
fix duplicate fontsize
Feb 19, 2020
7727fb3
clean up theme file
Feb 19, 2020
4fb89c4
refactor buttons to use internal buttonBase component
Feb 19, 2020
8c6e8c5
buttons are done! :tada:
Feb 19, 2020
a12c254
remove leftover button group styles
Feb 19, 2020
88ae6ad
update button group
Feb 19, 2020
a4fb6f5
add stickersheet
Feb 19, 2020
8e6b674
label updates
Feb 19, 2020
4c90709
dropdown updates
Feb 19, 2020
59bda58
match button styles
Feb 19, 2020
24eeb04
update TextInput
Feb 19, 2020
59fbf45
underline nav update
Feb 19, 2020
a0bbfa4
FilteredSearch update
Feb 19, 2020
7597bb4
StateLabel updates
Feb 19, 2020
15c3d43
underline nav updates
Feb 19, 2020
909dd7f
update focus styles
Feb 19, 2020
08ff8c3
label tweaks & state label update
Feb 20, 2020
08a420f
update stickersheet
Feb 20, 2020
1fdec4c
fix focus rings
Feb 20, 2020
79cea1a
update TextInput padding
Feb 20, 2020
95b6244
update focus on buttons
Feb 20, 2020
51564a7
update text input
Feb 20, 2020
94a0c1e
update active borders
Feb 20, 2020
5b78b37
add 100px radius to theme
Feb 20, 2020
d3bf5b1
remove bold from selected UnderlineNav link
Feb 21, 2020
3231f95
get fix
Feb 21, 2020
2acaca0
update label docs
Feb 21, 2020
d4e4143
lint it up
Feb 21, 2020
ce60da5
updated snapshots
Feb 21, 2020
29a73f9
remove sticker sheet
Feb 21, 2020
7e9fc6e
update default border radius
Feb 21, 2020
47bea7d
update SubNav border radius
Feb 21, 2020
1f20b38
update TabNav border radius and text color
Feb 21, 2020
dcbf794
update snapshots
Feb 21, 2020
c5b8204
give theme to wrapper
Feb 21, 2020
fa67dd3
lint
Feb 21, 2020
555d3d2
update Doctocat
Feb 21, 2020
0f293fc
update comment
Mar 5, 2020
a361806
update state label colors
Mar 5, 2020
3704927
update tests
Mar 5, 2020
2ba98fc
update version
Mar 6, 2020
f806470
Merge branch 'master' into refresh
Mar 6, 2020
8fffec2
update snaps
Mar 6, 2020
b093dc8
update selected color
Mar 6, 2020
8b9ce75
remove box shadow
Mar 6, 2020
3e8a065
update box shadow
Mar 6, 2020
1d22c12
Merge pull request #707 from primer/sidenav-refresh
Mar 9, 2020
8825458
update bg colors for buttons
Mar 9, 2020
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
14 changes: 11 additions & 3 deletions docs/content/Label.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ The Label component is used to add contextual metadata to a design. Visually it
## Default example

```jsx live
<Label m={1}>Default label</Label>
<Label m={1} dropshadow bg='red.4'>Label with custom background</Label>
<Label m={1} outline>Default outline label</Label>
<Label variant="small" outline borderColor="red.2" mr={2} color="red.4">small</Label>
<Label variant="medium" mr={2}>medium (default)</Label>
<Label variant="large" mr={2}>large</Label>
<Label variant="xl">xl label</Label>

<Box mt={4}/>
<Label variant="medium" bg="#A575FF" m={1}>good first issue</Label>
<Label variant="medium" bg="#FF75C8" m={1}>🚂 deploy: train</Label>
<Label variant="medium" bg="#1C90FA" m={1}>css</Label>
<Label variant="medium" bg=" #FFF06C" color="#24292E" m={1}>documentation</Label>
<Label variant="medium" bg="#656BFE" m={1}>primer</Label>
```

## System props
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"node": "10.x"
},
"dependencies": {
"@primer/gatsby-theme-doctocat": "^0.16.9",
"@primer/gatsby-theme-doctocat": "^0.16.10",
"@primer/octicons-react": "^9.2.0",
"@styled-system/prop-types": "^5.1.0",
"@styled-system/theme-get": "^5.1.0",
Expand Down
8 changes: 4 additions & 4 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1234,10 +1234,10 @@
react-is "16.10.2"
styled-system "5.1.2"

"@primer/gatsby-theme-doctocat@^0.16.9":
version "0.16.9"
resolved "https://registry.yarnpkg.com/@primer/gatsby-theme-doctocat/-/gatsby-theme-doctocat-0.16.9.tgz#7ab8b769ac02c9ceaa1d43d150e24b0e75989f6c"
integrity sha512-Nz23CpAorBMntpVuvCJfUK/1CKD0BxdjqAIvDbfaHzgUZgLSXthAdXupQl1OEp4EPnDb2Egv3ZBt4CT5ssfdNQ==
"@primer/gatsby-theme-doctocat@^0.16.10":
version "0.16.10"
resolved "https://registry.yarnpkg.com/@primer/gatsby-theme-doctocat/-/gatsby-theme-doctocat-0.16.10.tgz#9798bca7b08b548e8b9bd62f8ca7a8be9003d5a5"
integrity sha512-173EeoIEwf1cAO3te4XDYg+kjQwLhtlOU2LAHty8T7Hb8hjOLysBPO3rmmtz583+eWhASA0GBb6cvR5S6/OQHg==
dependencies:
"@babel/preset-env" "^7.5.5"
"@babel/preset-react" "^7.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@primer/components",
"version": "15.3.0",
"version": "16.0.0",
"description": "Primer react components",
"main": "dist/index.umd.js",
"module": "dist/index.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion src/BorderBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BorderBox.defaultProps = {
theme,
border: '1px solid',
borderColor: 'gray.2',
borderRadius: 1
borderRadius: 2
}

BorderBox.propTypes = {
Expand Down
64 changes: 32 additions & 32 deletions src/Button.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import PropTypes from 'prop-types'
import styled from 'styled-components'
import {COMMON} from './constants'
import theme from './theme'
import buttonStyles from './ButtonStyles'
import {compose, variant, layout, fontSize} from 'styled-system'
import systemPropTypes from '@styled-system/prop-types'
import {COMMON, get} from './constants'
import theme from './theme'
import ButtonBase from './ButtonBase'

const Button = styled(ButtonBase)`
color: ${get('buttons.default.color.default')};
background-color: ${get('buttons.default.bg.default')};
border: 1px solid ${get('buttons.default.border.default')};
box-shadow: ${get('buttons.default.shadow.default')};

&:hover {
background-color: ${get('buttons.default.bg.hover')};
border-color: ${get('buttons.default.border.hover')};
box-shadow: ${get('buttons.default.shadow.hover')};
}

// focus must come before :active so that the active box shadow overrides
&:focus {
border-color: transparent;
box-shadow: ${get('buttons.default.shadow.focus')};
}

&:active {
background-color: ${get('buttons.default.bg.active')};
box-shadow: ${get('buttons.default.shadow.active')};
border-color: ${get('buttons.default.border.active')};
}

const variants = variant({
variants: {
small: {
p: '3px 10px',
fontSize: 0
},
medium: {
fontSize: 1
},
large: {
fontSize: 2
}
&:disabled {
color: ${get('buttons.default.color.disabled')};
background-color: ${get('buttons.default.bg.disabled')};
border-color: ${get('buttons.default.border.disabled')};
}
})

const Button = styled.button.attrs(({disabled, onClick}) => ({
onClick: disabled ? undefined : onClick
}))`
${buttonStyles}
${variants}
${compose(fontSize, COMMON, layout)}
`

Button.defaultProps = {
theme,
variant: 'medium'
theme
}

Button.propTypes = {
as: PropTypes.oneOfType([PropTypes.oneOf(['button', 'a', 'summary', 'input']), PropTypes.func]),
children: PropTypes.node,
disabled: PropTypes.bool,
fontSize: systemPropTypes.typography.fontSize,
onClick: PropTypes.func,
theme: PropTypes.object,
variant: PropTypes.oneOf(['small', 'medium', 'large']),
...COMMON.propTypes,
...systemPropTypes.layout
}
Expand Down
50 changes: 50 additions & 0 deletions src/ButtonBase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import PropTypes from 'prop-types'
import styled from 'styled-components'
import {COMMON} from './constants'
import theme from './theme'
import buttonBaseStyles from './ButtonStyles'
import {compose, variant, layout, fontSize} from 'styled-system'
import systemPropTypes from '@styled-system/prop-types'

const variants = variant({
variants: {
small: {
p: '4px 12px',
fontSize: 0
},
medium: {
fontSize: 1
},
large: {
fontSize: 2,
p: '10px 20px'
}
}
})

const ButtonBase = styled.button.attrs(({disabled, onClick}) => ({
onClick: disabled ? undefined : onClick
}))`
${buttonBaseStyles}
${variants}
${compose(fontSize, COMMON, layout)}
`

ButtonBase.defaultProps = {
theme,
variant: 'medium'
}

ButtonBase.propTypes = {
as: PropTypes.oneOfType([PropTypes.oneOf(['button', 'a', 'summary', 'input']), PropTypes.func]),
children: PropTypes.node,
disabled: PropTypes.bool,
fontSize: systemPropTypes.typography.fontSize,
onClick: PropTypes.func,
theme: PropTypes.object,
variant: PropTypes.oneOf(['small', 'medium', 'large']),
...COMMON.propTypes,
...systemPropTypes.layout
}

export default ButtonBase
53 changes: 20 additions & 33 deletions src/ButtonDanger.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,36 @@
import styled from 'styled-components'
import Button from './Button'
import ButtonBase from './ButtonBase'
import {get} from './constants'

const ButtonDanger = styled(Button)`
color: ${get('colors.red.6')};
background-color: ${get('colors.gray.0')};
background-image: linear-gradient(-180deg, ${get('colors.gray.0')} 0%, ${get('colors.button.bg2')} 90%);
const ButtonDanger = styled(ButtonBase)`
color: ${get('buttons.danger.color.default')};
border: 1px solid ${get('buttons.danger.border.default')};
background-color: ${get('buttons.danger.bg.default')};
box-shadow: ${get('buttons.danger.shadow.default')};

&:hover {
color: ${get('colors.white')};
background-color: ${get('colors.red.6')};
background-image: linear-gradient(
-180deg,
${get('colors.button.dangerHoverBgImage')} 0%,
${get('colors.red.6')} 90%
);
border-color: ${get('colors.blackfade50')};
color: ${get('buttons.danger.color.hover')};
background-color: ${get('buttons.danger.bg.hover')};
border-color: ${get('buttons.danger.border.hover')};
box-shadow: ${get('buttons.danger.shadow.hover')};
}

// focus must come before :active so that the active box shadow overrides
&:focus {
box-shadow: ${get('colors.button.dangerFocusShadow')} 0px 0px 0px 0.2em;
border-color: transparent;
box-shadow: ${get('buttons.danger.shadow.focus')};
}

&:active {
color: ${get('colors.white')};
background-color: ${get('colors.button.dangerActiveBg')};
background-image: none;
box-shadow: ${get('colors.blackfade15')} 0px 0.15em 0.3em inset;
border-color: ${get('colors.blackfade50')};
}

&:selected {
color: ${get('colors.white')};
background-color: ${get('colors.button.dangerActiveBg')};
background-image: none;
box-shadow: ${get('colors.blackfade15')} 0px 0.15em 0.3em inset;
border-color: ${get('colors.blackfade50')};
color: ${get('buttons.danger.color.active')};
background-color: ${get('buttons.danger.bg.active')};
box-shadow: ${get('buttons.danger.shadow.active')};
border-color: ${get('buttons.danger.border.active')};
}

&:disabled {
color: ${get('colors.button.dangerDisabledColor')};
background-color: ${get('colors.button.disabledBg')};
background-image: none;
border-color: ${get('colors.blackfade20')};
box-shadow: none;
color: ${get('buttons.danger.color.disabled')};
background-color: ${get('buttons.danger.bg.disabled')};
border: 1px solid ${get('buttons.danger.border.default')};
}
`

Expand Down
9 changes: 5 additions & 4 deletions src/ButtonGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from 'styled-components'
import {get} from './constants'
import Box from './Box'

const ButtonGroup = styled(Box)`
Expand All @@ -10,8 +11,8 @@ const ButtonGroup = styled(Box)`
border-radius: 0;

:first-child {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
border-top-left-radius: ${get('radii.2')};
border-bottom-left-radius: ${get('radii.2')};
margin-right: 0;
}

Expand All @@ -22,8 +23,8 @@ const ButtonGroup = styled(Box)`

:last-child {
border-right-width: 1px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-top-right-radius: ${get('radii.2')};
border-bottom-right-radius: ${get('radii.2')};
}

:focus,
Expand Down
44 changes: 22 additions & 22 deletions src/ButtonOutline.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import styled from 'styled-components'
import Button from './Button'
import ButtonBase from './ButtonBase'
import {get} from './constants'

const ButtonOutline = styled(Button)`
color: ${get('colors.button.outlineBlue')};
background-color: ${get('colors.button.white')};
background-image: none;
const ButtonOutline = styled(ButtonBase)`
color: ${get('buttons.outline.color.default')};
border: 1px solid ${get('buttons.outline.border.default')};
background-color: ${get('buttons.outline.bg.default')};
box-shadow: ${get('buttons.outline.shadow.default')};

&:hover {
color: ${get('colors.button.white')};
background-color: ${get('colors.button.outlineBlue')};
background-image: none;
border-color: ${get('colors.button.outlineBlue')};
color: ${get('buttons.outline.color.hover')};
background-color: ${get('buttons.outline.bg.hover')};
border-color: ${get('buttons.outline.border.hover')};
box-shadow: ${get('buttons.outline.shadow.hover')};
}

&:active {
color: ${get('colors.button.white')};
background-color: ${get('colors.button.outlineBlue')};
background-image: none;
border-color: ${get('colors.button.outlineBlue')};
// focus must come before :active so that the active box shadow overrides
&:focus {
border-color: transparent;
box-shadow: ${get('buttons.outline.shadow.focus')};
}

&:focus {
box-shadow: ${get('colors.button.outlineShadow')} 0px 0px 0px 0.2em;
border-color: ${get('colors.button.outlineBlue')};
&:active {
color: ${get('buttons.outline.color.active')};
background-color: ${get('buttons.outline.bg.active')};
border-color: ${get('buttons.outline.border.active')};
box-shadow: ${get('buttons.outline.shadow.active')};
}

&:disabled {
color: ${get('colors.blackfade30')};
background-color: ${get('colors.white')};
border-color: ${get('colors.blackfade15')};
box-shadow: none;
color: ${get('buttons.outline.color.disabled')};
border-color: ${get('buttons.outline.border.default')};
background-color: ${get('buttons.outline.bg.disabled')};
}
`

Expand Down
Loading