Browse Source
feat(ui): add Background component
renovate/lint-staged-8.x
Tom Kirkpatrick
6 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
10 changed files with
145 additions and
0 deletions
-
app/components/UI/BackgroundDark.js
-
app/components/UI/BackgroundLight.js
-
app/components/UI/BackgroundLightest.js
-
stories/components/background.stories.js
-
test/unit/components/UI/BackgroundDark.spec.js
-
test/unit/components/UI/BackgroundLight.spec.js
-
test/unit/components/UI/BackgroundLightest.spec.js
-
test/unit/components/UI/__snapshots__/BackgroundDark.spec.js.snap
-
test/unit/components/UI/__snapshots__/BackgroundLight.spec.js.snap
-
test/unit/components/UI/__snapshots__/BackgroundLightest.spec.js.snap
|
|
@ -0,0 +1,16 @@ |
|
|
|
import React from 'react' |
|
|
|
import { Box } from 'rebass' |
|
|
|
|
|
|
|
/** |
|
|
|
* @render react |
|
|
|
* @name BackgroundDark |
|
|
|
* @example |
|
|
|
* <BackgroundDark /> |
|
|
|
*/ |
|
|
|
class BackgroundDark extends React.Component { |
|
|
|
render() { |
|
|
|
return <Box bg="darkestBackground" color="white" {...this.props} /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default BackgroundDark |
|
|
@ -0,0 +1,16 @@ |
|
|
|
import React from 'react' |
|
|
|
import { Box } from 'rebass' |
|
|
|
|
|
|
|
/** |
|
|
|
* @render react |
|
|
|
* @name BackgroundLight |
|
|
|
* @example |
|
|
|
* <BackgroundLight /> |
|
|
|
*/ |
|
|
|
class BackgroundLight extends React.Component { |
|
|
|
render() { |
|
|
|
return <Box bg="lightBackground" color="white" {...this.props} /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default BackgroundLight |
|
|
@ -0,0 +1,16 @@ |
|
|
|
import React from 'react' |
|
|
|
import { Box } from 'rebass' |
|
|
|
|
|
|
|
/** |
|
|
|
* @render react |
|
|
|
* @name BackgroundLightest |
|
|
|
* @example |
|
|
|
* <BackgroundLightest /> |
|
|
|
*/ |
|
|
|
class BackgroundLightest extends React.Component { |
|
|
|
render() { |
|
|
|
return <Box bg="lightestBackground" color="white" {...this.props} /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default BackgroundLightest |
|
|
@ -0,0 +1,28 @@ |
|
|
|
import React from 'react' |
|
|
|
import { storiesOf } from '@storybook/react' |
|
|
|
import BackgroundDark from 'components/UI/BackgroundDark' |
|
|
|
import BackgroundLight from 'components/UI/BackgroundLight' |
|
|
|
import BackgroundLightest from 'components/UI/BackgroundLightest' |
|
|
|
|
|
|
|
storiesOf('Components.Background', module) |
|
|
|
.add('dark', () => ( |
|
|
|
<BackgroundDark |
|
|
|
css={{ |
|
|
|
height: '50vh' |
|
|
|
}} |
|
|
|
/> |
|
|
|
)) |
|
|
|
.add('light', () => ( |
|
|
|
<BackgroundLight |
|
|
|
css={{ |
|
|
|
height: '50vh' |
|
|
|
}} |
|
|
|
/> |
|
|
|
)) |
|
|
|
.add('lightest', () => ( |
|
|
|
<BackgroundLightest |
|
|
|
css={{ |
|
|
|
height: '50vh' |
|
|
|
}} |
|
|
|
/> |
|
|
|
)) |
|
|
@ -0,0 +1,10 @@ |
|
|
|
import React from 'react' |
|
|
|
import BackgroundDark from 'components/UI/BackgroundDark' |
|
|
|
import renderer from 'react-test-renderer' |
|
|
|
|
|
|
|
describe('component.UI.BackgroundDark', () => { |
|
|
|
it('should render correctly', () => { |
|
|
|
const tree = renderer.create(<BackgroundDark />).toJSON() |
|
|
|
expect(tree).toMatchSnapshot() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -0,0 +1,10 @@ |
|
|
|
import React from 'react' |
|
|
|
import BackgroundLight from 'components/UI/BackgroundLight' |
|
|
|
import renderer from 'react-test-renderer' |
|
|
|
|
|
|
|
describe('component.UI.BackgroundLight', () => { |
|
|
|
it('should render correctly', () => { |
|
|
|
const tree = renderer.create(<BackgroundLight />).toJSON() |
|
|
|
expect(tree).toMatchSnapshot() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -0,0 +1,10 @@ |
|
|
|
import React from 'react' |
|
|
|
import BackgroundLightest from 'components/UI/BackgroundLightest' |
|
|
|
import renderer from 'react-test-renderer' |
|
|
|
|
|
|
|
describe('component.UI.BackgroundLightest', () => { |
|
|
|
it('should render correctly', () => { |
|
|
|
const tree = renderer.create(<BackgroundLightest />).toJSON() |
|
|
|
expect(tree).toMatchSnapshot() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -0,0 +1,13 @@ |
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
|
|
|
|
|
|
|
exports[`component.UI.BackgroundDark should render correctly 1`] = ` |
|
|
|
.c0 { |
|
|
|
color: white; |
|
|
|
background-color: darkestBackground; |
|
|
|
} |
|
|
|
|
|
|
|
<div |
|
|
|
className="c0" |
|
|
|
color="white" |
|
|
|
/> |
|
|
|
`; |
|
|
@ -0,0 +1,13 @@ |
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
|
|
|
|
|
|
|
exports[`component.UI.BackgroundLight should render correctly 1`] = ` |
|
|
|
.c0 { |
|
|
|
color: white; |
|
|
|
background-color: lightBackground; |
|
|
|
} |
|
|
|
|
|
|
|
<div |
|
|
|
className="c0" |
|
|
|
color="white" |
|
|
|
/> |
|
|
|
`; |
|
|
@ -0,0 +1,13 @@ |
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
|
|
|
|
|
|
|
exports[`component.UI.BackgroundLightest should render correctly 1`] = ` |
|
|
|
.c0 { |
|
|
|
color: white; |
|
|
|
background-color: lightestBackground; |
|
|
|
} |
|
|
|
|
|
|
|
<div |
|
|
|
className="c0" |
|
|
|
color="white" |
|
|
|
/> |
|
|
|
`; |