Skip to content

Commit

Permalink
feat(component): Add maxBlur property
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored May 2, 2017
1 parent ee7a999 commit fc224d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface ProgressiveImageProps {
backgroundImages?: string[];
transitionTime?: number;
timingFunction?: string;
maxBlur?: number;
}

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

static defaultProps = {
transitionTime: 500,
timingFunction: "ease"
timingFunction: "ease",
maxBlur: 10
};

componentWillMount() {
const {src, preview} = this.props;
this.setState({ src: "", blur: 10 });
const {src, preview, maxBlur} = this.props;
this.setState({ src: "", blur: maxBlur });
this.cloneProps();
this.fetch(preview)
.then(previewDataURI => this.setState({ src: previewDataURI, blur: 10 }))
.then(previewDataURI => this.setState({ src: previewDataURI, blur: maxBlur }))
.then(() => this.fetch(src))
.then(srcDataURI => this.setState({ src: srcDataURI, blur: 0 }));
}
Expand Down

0 comments on commit fc224d1

Please sign in to comment.