-
Notifications
You must be signed in to change notification settings - Fork 812
/
index.js
41 lines (35 loc) · 955 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import PropTypes from 'prop-types';
import React from 'react';
import {connect, CropperContainer} from '../../containers';
import Handles from './handles';
import Cursor from './cursor';
class Cropper extends React.Component {
render() {
const {startMoving, width, height, isResizing} = this.props;
return (
<Handles>
<div
className="cropper"
onMouseDown={startMoving}/>
{ isResizing && <Cursor width={width} height={height}/> }
<style jsx>{`
.cropper {
flex: 1;
z-index: 6;
}
`}</style>
</Handles>
);
}
}
Cropper.propTypes = {
startMoving: PropTypes.elementType.isRequired,
width: PropTypes.number,
height: PropTypes.number,
isResizing: PropTypes.bool
};
export default connect(
[CropperContainer],
({width, height, isResizing}) => ({width, height, isResizing}),
({startMoving}) => ({startMoving})
)(Cropper);