Skip to content

Commit

Permalink
Support background-images (#15)
Browse files Browse the repository at this point in the history
* Removed the specificity of `backgroundColor` for a more inclusive `background`

Signed-off-by: Blake Stephens <blake.stephens@lge.com>

* Updated styles type definition too
Oops. Not too familiar with typescript

Signed-off-by: Blake Stephens <blake.stephens@lge.com>

* Updated test too
Thanks Travis.

Signed-off-by: Blake Stephens <blake.stephens@lge.com>
  • Loading branch information
Blake Stephens authored and ndelangen committed Nov 2, 2017
1 parent d65656e commit c8129e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/background/src/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Background Decorator", () => {
const SpiedChannel = new EventEmitter();
const backgroundDecorator = shallow(<BackgroundDecorator story={testStory} channel={SpiedChannel} />);

expect(backgroundDecorator.html().match(/background-color:transparent/gmi).length).toBe(1);
expect(backgroundDecorator.html().match(/background:transparent/gmi).length).toBe(1);
});

it("should set internal state when background event called", () => {
Expand Down
4 changes: 2 additions & 2 deletions addons/background/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const style = {
transition: "background 0.25s ease-in-out",
backgroundPosition: "center",
backgroundSize: "cover",
backgroundColor: "transparent",
background: "transparent",
},
};

Expand Down Expand Up @@ -57,7 +57,7 @@ export class BackgroundDecorator extends React.Component<any, any> {

render() {
const styles = style.wrapper;
styles.backgroundColor = this.state.background;
styles.background = this.state.background;
return <div style={assign({}, styles)}>{this.story}</div>;
}
}
Expand Down

0 comments on commit c8129e1

Please sign in to comment.