Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Caret with emotion #184

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/Caret.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import Box from './Box'
import {style} from 'styled-system'
import {withDefaultTheme} from './system-props'
import {withSystemProps, COMMON} from './system-props'

const oppositeEdge = {
top: 'Bottom',
Expand Down Expand Up @@ -75,7 +75,7 @@ function Caret(props) {
}[edge]

return (
<svg width={size * 2} height={size * 2} style={style}>
<svg width={size * 2} height={size * 2} style={style} className={props.className}>
<g transform={transform}>
<path d={triangle} fill={bg} />
<path d={line} fill="none" stroke={borderColor} strokeWidth={borderWidth} />
Expand Down Expand Up @@ -120,4 +120,4 @@ Caret.propTypes = {
/* eslint-enable */
}

export default withDefaultTheme(Caret)
export default withSystemProps(Caret, COMMON)
6 changes: 6 additions & 0 deletions src/__tests__/Caret.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import Caret from '../Caret'
import {render} from '../utils/testing'
import {COMMON} from '../system-props'
import theme from '../theme'

describe('Caret', () => {
Expand All @@ -19,4 +20,9 @@ describe('Caret', () => {
expect(render(<Caret location={location} theme={theme} />)).toMatchSnapshot()
}
})

it('implements common system props', () => {
expect(Caret).toImplementSystemProps(COMMON)
})

})
108 changes: 84 additions & 24 deletions src/__tests__/__snapshots__/Caret.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Caret renders cardinal directions 1`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -19,20 +24,25 @@ exports[`Caret renders cardinal directions 1`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 2`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -50,20 +60,25 @@ exports[`Caret renders cardinal directions 2`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 3`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -81,20 +96,25 @@ exports[`Caret renders cardinal directions 3`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 4`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -112,20 +132,25 @@ exports[`Caret renders cardinal directions 4`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 5`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -143,20 +168,25 @@ exports[`Caret renders cardinal directions 5`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 6`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -174,20 +204,25 @@ exports[`Caret renders cardinal directions 6`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 7`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -205,20 +240,25 @@ exports[`Caret renders cardinal directions 7`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 8`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -236,20 +276,25 @@ exports[`Caret renders cardinal directions 8`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 9`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -267,20 +312,25 @@ exports[`Caret renders cardinal directions 9`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 10`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -298,20 +348,25 @@ exports[`Caret renders cardinal directions 10`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 11`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -329,20 +384,25 @@ exports[`Caret renders cardinal directions 11`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
</svg>
`;

exports[`Caret renders cardinal directions 12`] = `
.emotion-0 {
background-color: #fff;
}

<svg
className="emotion-0"
height={16}
style={
Object {
Expand All @@ -360,12 +420,12 @@ exports[`Caret renders cardinal directions 12`] = `
>
<path
d="M-8,0L0,8L8,0L-8,0Z"
fill="#fff"
fill="white"
/>
<path
d="M-8,0L0,8L8,0"
fill="none"
stroke="#e1e4e8"
stroke="gray.2"
strokeWidth={1}
/>
</g>
Expand Down
Loading