Skip to content

Commit bf17d88

Browse files
author
Emily
authored
Merge pull request #299 from primer/release-3.0.1
Release PR for 3.0.1.-beta
2 parents e4b5829 + e8a6df6 commit bf17d88

5 files changed

Lines changed: 42 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@primer/components",
3-
"version": "3.0.0-beta",
3+
"version": "3.0.1-beta",
44
"description": "Primer react components",
55
"main": "dist/index.umd.js",
66
"module": "dist/index.esm.js",

src/Link.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
import PropTypes from 'prop-types'
22
import styled from 'react-emotion'
33
import {withSystemProps, TYPOGRAPHY} from './system-props'
4+
import theme from './theme'
5+
import {themeGet, get} from 'styled-system'
6+
7+
const getHoverColor = (hoverColor = 'blue.4') => {
8+
const path = `colors.${hoverColor}`
9+
const fallback = get(theme, path)
10+
return themeGet(path, fallback)
11+
}
12+
13+
const hoverStyles = ({...rest}) => {
14+
return {
15+
color: getHoverColor(rest.hoverColor)(rest)
16+
}
17+
}
418

519
const styledLink = styled('a')`
620
text-decoration: ${props => (props.underline ? 'underline' : 'none')};
721
&:hover {
822
text-decoration: underline;
23+
${hoverStyles};
924
}
1025
`
1126

src/__tests__/Link.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ describe('Link', () => {
2424
it('renders without any props', () => {
2525
expect(render(<Link />)).toMatchSnapshot()
2626
})
27+
28+
it('respects hoverColor prop', () => {
29+
expect(render(<Link hoverColor="blue.4" />)).toMatchSnapshot()
30+
})
2731
})

src/__tests__/__snapshots__/Link.js.snap

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports[`Link passes href down to link element 1`] = `
1010
.emotion-0:hover {
1111
-webkit-text-decoration: underline;
1212
text-decoration: underline;
13+
color: #2188ff;
1314
}
1415
1516
<a
@@ -29,6 +30,26 @@ exports[`Link renders without any props 1`] = `
2930
.emotion-0:hover {
3031
-webkit-text-decoration: underline;
3132
text-decoration: underline;
33+
color: #2188ff;
34+
}
35+
36+
<a
37+
className="emotion-0"
38+
color="blue.5"
39+
/>
40+
`;
41+
42+
exports[`Link respects hoverColor prop 1`] = `
43+
.emotion-0 {
44+
-webkit-text-decoration: none;
45+
text-decoration: none;
46+
color: #0366d6;
47+
}
48+
49+
.emotion-0:hover {
50+
-webkit-text-decoration: underline;
51+
text-decoration: underline;
52+
color: #2188ff;
3253
}
3354
3455
<a

src/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const theme = {
5858
large: '0 1px 15px rgba(27, 31, 35, 0.15)',
5959
'extra-large': '0 10px 50px rgba(27, 31, 35, 0.07)'
6060
},
61-
space: [0, 4, 8, 16, 24, 32, 40, 48]
61+
space: [0, 4, 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128]
6262
}
6363

6464
export default theme

0 commit comments

Comments
 (0)