import * as React from "react";
import Util from "../../../../util/utils";

class GroupRight extends React.Component<any, any> {
    constructor(props) {
        super(props);
        this.state = {
            style: {}
        }
    }

    componentDidMount(): void {

    }

    getProData(item, proStyle) {
        let content = [];
        if (item.proList) {
            content = item.proList;
        }
        // if (item.showStyle != 2) {
        //     let count = Number(item.count);
        //     content = content.slice(0, count);
        // }
        content = item.proList;
        let data = {};
        data['content'] = content;
        let postData = Object.assign(data, proStyle);
        return postData;
    }


    render() {
        let groupList = this.props.data;
        let getProData = this.getProData.bind(this);
        let proStyle = this.props.proStyle;
        return (
            <div className={'shop-tabs-content shop-tabs-content-left'}>
                {
                    groupList.map((item, index) => (
                        <div key={index}
                             className={'shop-tabs-panel' + (this.state.currentIndex == index ? ' active' : '')}>
                            {
                                item.proList && item.proList.length > 0 ?
                                    <div>
                                        <p className={'shop-tabs-title'}>{item.name}</p>
                                        {
                                            Util.transInReactNode(getProData(item, proStyle))
                                        }
                                    </div> : ''
                            }
                        </div>
                    ))
                }
            </div>
        );
    }
}

export default GroupRight;