Skip to content

Commit 4b8427f

Browse files
authored
fix(component): Bug fixes
1 parent cf76088 commit 4b8427f

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/index.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,12 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps & Di
2828

2929
render() {
3030
const {src, style, background} = this.props;
31-
return (
32-
<div>
33-
<style>{`
34-
@-webkit-keyframes blur {
35-
0% { -webkit-filter: blur(10px); }
36-
100% { -webkit-filter: blur(0); }
37-
}
38-
`}</style>
39-
{
40-
background ?
41-
<div style={assign(this.getBackgroundStyle(), style)} {...this.clonedProps} />
42-
:
43-
<img src={src} style={assign(this.getStyle(), style)} {...this.clonedProps} />
44-
}
45-
46-
</div>
47-
);
31+
return
32+
background ?
33+
<div style={assign(this.getBackgroundStyle(), style)} {...this.clonedProps} />
34+
:
35+
<img src={src} style={assign(this.getStyle(), style)} {...this.clonedProps} />
36+
;
4837
}
4938

5039
private cloneProps() {
@@ -57,8 +46,7 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps & Di
5746
const {blur} = this.state;
5847
return {
5948
filter: `blur(${blur}px)`,
60-
animation: "blur 400ms",
61-
animationTimingFunction: "ease"
49+
transition: "blur 500ms ease"
6250
};
6351
}
6452

@@ -67,8 +55,7 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps & Di
6755
return {
6856
backgroundImage: `url(${src})`,
6957
filter: `blur(${blur}px)`,
70-
animation: "blur 400ms",
71-
animationTimingFunction: "ease"
58+
transition: "blur 500ms ease"
7259
};
7360
}
7461
}

0 commit comments

Comments
 (0)