move static props

This commit is contained in:
casperlamboo 2017-11-14 13:49:31 +01:00
parent 1de526f83f
commit 7aac749d77
2 changed files with 30 additions and 34 deletions

View File

@ -7,13 +7,16 @@ import PouchDB from 'pouchdb';
// const debug = createDebug('d3d:FileThumb');
class AuthImage extends React.Component {
constructor() {
super();
static propTypes = {
dispatch: PropTypes.func,
src: PropTypes.string.isRequired,
token: PropTypes.string,
password: PropTypes.string
};
this.state = {
src: null
};
}
state = {
src: null
};
componentWillMount() {
const { src, token, password } = this.props;
@ -55,12 +58,6 @@ class AuthImage extends React.Component {
return (<img { ...props } src={this.state.src} />);
}
}
AuthImage.propTypes = {
dispatch: PropTypes.func,
src: PropTypes.string.isRequired,
token: PropTypes.string,
password: PropTypes.string
};
export default connect(state => ({
token: state.user.session.token,

View File

@ -18,12 +18,27 @@ const styles = {
};
class DoodlePreview extends React.Component {
constructor() {
super();
this.state = {
scene: null
};
}
static defaultProps = {
width: 720,
height: 480,
pixelRatio: 1
};
static propTypes = {
classes: PropTypes.objectOf(PropTypes.string),
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
pixelRatio: PropTypes.number.isRequired,
sketchData: PropTypes.object, // TODO
docData: PropTypes.shape({
appVersion: PropTypes.string,
data: PropTypes.string
})
};
state = {
scene: null
};
async componentDidMount() {
let { docData, sketchData } = this.props;
@ -65,21 +80,5 @@ class DoodlePreview extends React.Component {
);
}
}
DoodlePreview.defaultProps = {
width: 720,
height: 480,
pixelRatio: 1
};
DoodlePreview.propTypes = {
classes: PropTypes.objectOf(PropTypes.string),
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
pixelRatio: PropTypes.number.isRequired,
sketchData: PropTypes.object, // TODO
docData: PropTypes.shape({
appVersion: PropTypes.string,
data: PropTypes.string
})
};
export default injectSheet(styles)(DoodlePreview);