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

100% Statements 9/9
100% Branches 12/12
100% Functions 3/3
100% Lines 9/9
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 431x 1x 1x 1x       18x   18x     1x   1x                                       1x                
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {ContentsMini} from "nexshop-web-contents-mini-view";
import SceneLayoutItemView from "./scene-layout-item-view";
 
class SceneResourceView extends Component {
    render() {
        const {changeLayout, selectedTabId, selectTab, selectedLayoutId, orientation} = this.props;
 
        return (
            <div className="scene-resource-wrapper">
                <div className='scene-tab__header'>
                    <div className={`scene-tab__button${selectedTabId === 'layout' ? '--selected' : ''}`} onClick={() => selectTab('layout')}>Layout</div>
                    <div className={`scene-tab__button${selectedTabId === 'template' ? '--selected' : ''}`}>Templates</div>
                    <div className={`scene-tab__button${selectedTabId === 'contents' ? '--selected' : ''}`} onClick={() => selectTab('contents')}>Contents</div>
                    <div className={`scene-tab__button${selectedTabId === 'widget' ? '--selected' : ''}`}/>
                </div>
                <div className='scene-tab__body'>
                    {
                        selectedTabId === 'layout' &&
                        <SceneLayoutItemView changeLayout={changeLayout}
                                             orientation={orientation}
                                             selectedLayoutId={selectedLayoutId} />
                    }
                    {
                        selectedTabId === 'contents' &&
                        <ContentsMini className="scene-tab__body__contents" contentsIgnore={['playlist', 'scene']}/>
                    }
                </div>
            </div>
        );
    }
}
 
SceneResourceView.propTypes = {
    changeLayout: PropTypes.func.isRequired,
    selectTab: PropTypes.func.isRequired,
    selectedTabId: PropTypes.string.isRequired,
    selectedLayoutId: PropTypes.string.isRequired,
    orientation: PropTypes.string.isRequired,
};
 
export default SceneResourceView;