Skip to content

Commit fc224d1

Browse files
authored
feat(component): Add maxBlur property
1 parent ee7a999 commit fc224d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface ProgressiveImageProps {
1010
backgroundImages?: string[];
1111
transitionTime?: number;
1212
timingFunction?: string;
13+
maxBlur?: number;
1314
}
1415

1516
export interface ProgressiveImageState {
@@ -23,15 +24,16 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps & Di
2324

2425
static defaultProps = {
2526
transitionTime: 500,
26-
timingFunction: "ease"
27+
timingFunction: "ease",
28+
maxBlur: 10
2729
};
2830

2931
componentWillMount() {
30-
const {src, preview} = this.props;
31-
this.setState({ src: "", blur: 10 });
32+
const {src, preview, maxBlur} = this.props;
33+
this.setState({ src: "", blur: maxBlur });
3234
this.cloneProps();
3335
this.fetch(preview)
34-
.then(previewDataURI => this.setState({ src: previewDataURI, blur: 10 }))
36+
.then(previewDataURI => this.setState({ src: previewDataURI, blur: maxBlur }))
3537
.then(() => this.fetch(src))
3638
.then(srcDataURI => this.setState({ src: srcDataURI, blur: 0 }));
3739
}

0 commit comments

Comments
 (0)