All files / nexshop-web-contents/src/component/preview/scene scene-preview.js

100% Statements 14/14
100% Branches 0/0
100% Functions 4/4
100% Lines 14/14
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 401x 1x 1x 1x 1x       7x   7x       1x       7x 7x   7x                   1x     7x   7x      
import React, {Component} from 'react';
import {connect} from "react-redux";
import _ from 'lodash';
import ScenePreviewHeaderView from "./scene-preview-header-view";
import ScenePreviewDetailView from "./scene-preview-detail-view";
 
class ScenePreview extends Component {
    constructor(props) {
        super(props);
 
        this.onClickClose = this.onClickClose.bind(this);
    }
 
    onClickClose() {
        this.props.history.goBack();
    }
 
    render() {
        const {scene, name, previewWindowSize, sceneLayoutSize} = this.props;
        const clonedScene = _.cloneDeep(scene);
 
        return (
            <div>
                <ScenePreviewHeaderView name={name} onClickClose={this.onClickClose}/>
                <ScenePreviewDetailView scene={clonedScene} previewWindowSize={previewWindowSize}
                                        sceneLayoutSize={sceneLayoutSize}/>
            </div>
        );
    }
}
 
const mapStateToProps = (state) => {
    const {
        scene: {scene, name, previewWindowSize, sceneLayoutSize}
    } = state;
 
    return {scene, name, previewWindowSize, sceneLayoutSize};
};
 
export default connect(mapStateToProps)(ScenePreview);