-
Notifications
You must be signed in to change notification settings - Fork 0
/
HugeImg.js
49 lines (47 loc) · 1.27 KB
/
HugeImg.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
42
43
44
45
46
47
48
49
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
import {connect} from 'react-redux'
import PicLoadingPng from '../loginAndRegist/picLoading.png';
class HugeImg extends React.Component {
render(){
const {hugeImgUrl, dispatch, classes} = this.props;
if(!hugeImgUrl) return null;
// console.log('1111111111111111111111111', hugeImgUrl)
return (
<div className={classes.hugImgBackground}
onClick={()=>{dispatch({ type:'appModel/updateState',payload:{hugeImgUrl: undefined} });}}
>
<div className={classes.hugImgContainer}>
<img src={hugeImgUrl} style={{width: '100%'}}/>
</div>
</div>
);
}
}
const styles=()=>({
hugImgBackground: {
position: 'fixed',
top: 0,
bottom:0,
left:0,
right:0,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundImage: `url(${PicLoadingPng})`,
backgroundRepeat: 'no-repeat',
backgroundPositionX: 'center',
backgroundPositionY: 'center',
zIndex:9999
},
hugImgContainer: {
overflowY: 'auto',
boxShadow: '0 0 15px #000',
maxHeight: '90%'
},
});
export default connect(
function({appModel: {hugeImgUrl}}){
return ({hugeImgUrl});
}
)(withStyles(styles)(HugeImg));