index.js 1.36 KB
Newer Older
1 2 3 4 5 6 7
import React, { Component } from 'react';
import './video-catalog.scss'
import classnames from 'classnames'


class VideoCatalog extends Component {

zhanghaozhe committed
8 9 10 11
    handleClick = (i) => {
        this.props.handleClick(i)
    }

12 13 14 15 16
    render() {
        return (
            <div className='video-catalog'>
                <ul>
                    {
zhanghaozhe committed
17
                        this.props.videoCatalog.map((item, index) => {
18
                            return (
zhanghaozhe committed
19 20 21 22
                                <li key={item.id}
                                    className={classnames({active: this.props.activeIndex === index})}
                                    onClick={this.handleClick.bind(this, index)}
                                >
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
                                    <span className="title">{item.name}</span>
                                    <span className='duration'>{item.duration}</span>
                                    <i className={classnames(`iconfont`,
                                        [item.video_auth === 0
                                            ? 'iconiconfront-74'
                                            : 'iconiconfront-35'],
                                    )}/>
                                </li>
                            )
                        })
                    }
                </ul>
            </div>
        );
    }
}

export default VideoCatalog;