Created
December 22, 2017 04:51
-
-
Save brizental/9d1cf99e36113f31737651c75c4ab1aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import IdCrop from 'idcrop' | |
import Head from 'next/head' | |
class IdCropComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
componentDidMount() { | |
const idcrop = new IdCrop( | |
"#displayContainer", | |
"#previewContainer", | |
false, | |
4 | |
); | |
idcrop.init(); | |
} | |
render() { | |
const displayStyles = { | |
backgroundImage:"url('/static/test.jpg')" | |
} | |
return ( | |
<div id='idcrop'> | |
<div id='displayContainer' style={displayStyles}></div> | |
<div id='previewContainer'></div> | |
</div> | |
); | |
} | |
} | |
export default () => ( | |
<div> | |
<Head> | |
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/dist/css/main.min.css" /> | |
</Head> | |
<IdCropComponent /> | |
</div> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment