mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 05:51:48 +08:00
Support background-images (#15)
* 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>
This commit is contained in:
parent
d65656e236
commit
c8129e14cc
@ -24,7 +24,7 @@ describe("Background Decorator", () => {
|
|||||||
const SpiedChannel = new EventEmitter();
|
const SpiedChannel = new EventEmitter();
|
||||||
const backgroundDecorator = shallow(<BackgroundDecorator story={testStory} channel={SpiedChannel} />);
|
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", () => {
|
it("should set internal state when background event called", () => {
|
||||||
|
@ -13,7 +13,7 @@ const style = {
|
|||||||
transition: "background 0.25s ease-in-out",
|
transition: "background 0.25s ease-in-out",
|
||||||
backgroundPosition: "center",
|
backgroundPosition: "center",
|
||||||
backgroundSize: "cover",
|
backgroundSize: "cover",
|
||||||
backgroundColor: "transparent",
|
background: "transparent",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ export class BackgroundDecorator extends React.Component<any, any> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const styles = style.wrapper;
|
const styles = style.wrapper;
|
||||||
styles.backgroundColor = this.state.background;
|
styles.background = this.state.background;
|
||||||
return <div style={assign({}, styles)}>{this.story}</div>;
|
return <div style={assign({}, styles)}>{this.story}</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user