Skip to content

Commit 36840f0

Browse files
author
Emily
authored
Merge pull request #382 from primer/dep-fix
Move styled-components to deps instead of dev-deps
2 parents 06f4a73 + d9490d1 commit 36840f0

19 files changed

+137
-11
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@primer/components",
3-
"version": "8.0.0-beta",
3+
"version": "8.2.0-beta",
44
"description": "Primer react components",
55
"main": "dist/index.umd.js",
66
"module": "dist/index.esm.js",
@@ -46,6 +46,7 @@
4646
"primer-typography": "1.0.1",
4747
"react": "16.4.2",
4848
"react-dom": "16.4.2",
49+
"styled-components": "4.1.2",
4950
"styled-system": "3.1.3",
5051
"system-components": "3.0.1"
5152
},
@@ -86,7 +87,6 @@
8687
"rollup": "0.62.0",
8788
"rollup-plugin-babel": "4.0.0-beta.8",
8889
"rollup-plugin-commonjs": "9.1.3",
89-
"sass.macro": "0.1.0",
90-
"styled-components": "4.1.2"
90+
"sass.macro": "0.1.0"
9191
}
9292
}

src/Box.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import styled from 'styled-components'
22
import PropTypes from 'prop-types'
3-
import {LAYOUT, COMMON} from './constants'
3+
import {LAYOUT, COMMON, Base} from './constants'
44
import theme from './theme'
55

6-
const Box = styled.div`
6+
const Box = styled(Base)`
77
${LAYOUT} ${COMMON};
88
`
99

src/CircleOcticon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import theme from './theme'
66
import BorderBox from './BorderBox'
77

88
function CircleOcticon(props) {
9-
const {size} = props
9+
const {size, is} = props
1010
const {icon, bg, ...rest} = props
1111
return (
12-
<BorderBox bg={bg} overflow="hidden" border="none" size={size} borderRadius="50%">
12+
<BorderBox is={is} bg={bg} overflow="hidden" border="none" size={size} borderRadius="50%">
1313
<Flex {...rest} alignItems="center" justifyContent="center">
1414
<Octicon icon={icon} size={size} />
1515
</Flex>

src/Flash.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types'
22
import styled from 'styled-components'
3-
import {COMMON, get} from './constants'
3+
import {COMMON, get, Base} from './constants'
44
import theme from './theme'
55

66
const schemeMap = {
@@ -10,7 +10,7 @@ const schemeMap = {
1010
base: {color: 'colors.blue.8', bg: 'colors.blue.1'}
1111
}
1212

13-
const Flash = styled.div`
13+
const Flash = styled(Base)`
1414
position: relative;
1515
padding: ${get('space.3')}px;
1616
color: ${props => get(schemeMap[props.scheme] ? schemeMap[props.scheme].color : '')};

src/PointerBox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {Relative} from './Position'
77

88
function PointerBox(props) {
99
// don't destructure these, just grab them
10-
const {bg, border, borderColor} = props
10+
const {bg, border, borderColor, is} = props
1111
const {caret, children, ...boxProps} = props
1212
const caretProps = {bg, borderColor, borderWidth: border, location: caret}
1313
return (
14-
<Relative>
14+
<Relative is={is}>
1515
<BorderBox {...boxProps}>
1616
{children}
1717
<Caret {...caretProps} />

src/__tests__/BorderBox.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ describe('BorderBox', () => {
1414
expect(BorderBox).toSetDefaultTheme()
1515
})
1616

17+
it('respects the "is" prop', () => {
18+
expect(render(<BorderBox is="span" />).type).toEqual('span')
19+
})
20+
1721
it('renders borders', () => {
1822
expect(render(<BorderBox borderColor="green.5" />)).toHaveStyleRule('border-color', colors.green[5])
1923
expect(render(<BorderBox borderBottom={0} />)).toHaveStyleRule('border-bottom', '0')

src/__tests__/Box.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ describe('Box', () => {
1010
expect(Box).toImplementSystemProps(COMMON)
1111
})
1212

13+
it('respects the "is" prop', () => {
14+
expect(render(<Box is="span" />).type).toEqual('span')
15+
})
16+
1317
it('renders without any props', () => {
1418
expect(render(<Box />)).toMatchSnapshot()
1519
})

src/__tests__/CircleOcticon.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ describe('CircleOcticon', () => {
2828
expect(result).toHaveStyleRule('width', '32px')
2929
expect(result).toHaveStyleRule('height', '32px')
3030
})
31+
32+
it('respects the "is" prop', () => {
33+
expect(render(<CircleOcticon icon={Check} is="span" />).type).toEqual('span')
34+
})
3135
})

src/__tests__/CounterLabel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ describe('CounterLabel', () => {
2929
it('implements system props', () => {
3030
expect(CounterLabel).toImplementSystemProps(COMMON)
3131
})
32+
33+
it('respects the "is" prop', () => {
34+
expect(render(<CounterLabel is="span" />).type).toEqual('span')
35+
})
3236
})

src/__tests__/Flash.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ describe('Flash', () => {
1919
expect(render(<Flash full />)).toHaveStyleRule('border-width', '1px 0px')
2020
})
2121

22+
it('respects the "is" prop', () => {
23+
expect(render(<Flash is="span" />).type).toEqual('span')
24+
})
25+
2226
it('respects the "scheme" prop', () => {
2327
expect(render(<Flash scheme="yellow" theme={theme} />)).toHaveStyleRule('color', colors.yellow[9])
2428
expect(render(<Flash scheme="red" theme={theme} />)).toHaveStyleRule('color', colors.red[9])

0 commit comments

Comments
 (0)