All files / nexshop-web-contents/src/component/playlist playlist-title-view.js

100% Statements 5/5
100% Branches 4/4
100% Functions 2/2
100% Lines 5/5
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 271x 1x       7x         1x                     1x          
import React, {Component} from 'react';
import PropTypes from 'prop-types';
 
export default class PlaylistTitleView extends Component {
    render() {
        return (
            <div className="top-bar-sub">
                <div className="top-bar-sub__title">{this.props.name}</div>
                <div className="top-bar-sub-menu">
                    <div className={`top-bar-sub-menu__item${this.props.hasPlaylistItem ? '' : '--inactive'}`}
                         onClick={() => this.props.onPreviewClick(0)}>PREVIEW
                    </div>
                    <div className={`top-bar-sub-menu__item${this.props.hasPlaylistItem ? '' : '--inactive'}`}
                         onClick={this.props.onSavePlaylist}>SAVE
                    </div>
                </div>
            </div>
        );
    }
}
 
PlaylistTitleView.propTypes = {
    name: PropTypes.string.isRequired,
    hasPlaylistItem: PropTypes.bool,
    onSavePlaylist: PropTypes.func.isRequired,
    onPreviewClick: PropTypes.func.isRequired,
};