summaryrefslogtreecommitdiff
path: root/frontend/common/imageCrop.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-09-26 14:56:02 +0200
committerJules Laplace <julescarbon@gmail.com>2020-09-26 14:56:02 +0200
commita17b76ac75f506f5da6fe8adf9c36632b60d4226 (patch)
treeabb0af0c4409b830dea2ef808c146223ee973933 /frontend/common/imageCrop.component.js
parent2231a6e1c05b07bb7ec5906716aedec93d02429c (diff)
refactor to use app-rooted js imports
Diffstat (limited to 'frontend/common/imageCrop.component.js')
-rw-r--r--frontend/common/imageCrop.component.js41
1 files changed, 0 insertions, 41 deletions
diff --git a/frontend/common/imageCrop.component.js b/frontend/common/imageCrop.component.js
deleted file mode 100644
index 9cae850..0000000
--- a/frontend/common/imageCrop.component.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React, { Component } from 'react';
-import { cropImage } from '../util'
-
-export default class ImageCrop extends Component {
- state = {
- cropURL: null
- }
-
- componentDidMount() {
- const { url, crop } = this.props
- this.crop(url, crop)
- }
-
- componentDidUpdate(prevProps) {
- const { url, crop } = this.props
- if (this.props.crop !== prevProps.crop) {
- cropImage(url, crop).then(canvas =>{
- const cropURL = canvas.toDataURL('image/jpeg', 0.8)
- this.setState({ cropURL })
- })
- }
- }
-
- crop(url, crop) {
- cropImage(url, crop).then(canvas =>{
- const cropURL = canvas.toDataURL('image/jpeg', 0.8)
- this.setState({ cropURL })
- })
- }
-
-
- render() {
- const { cropURL } = this.state
- if (!cropURL) {
- return null
- }
- return (
- <img src={cropURL} className='preview' />
- )
- }
-}