{"size": 1938, "ext": "js", "max_stars_repo_path": "src/ReactVideo/Navigation.js", "max_stars_repo_name": "ConfirmitASA/r-react-video", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/ReactVideo/Navigation.js", "max_issues_repo_name": "ConfirmitASA/r-react-video", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ReactVideo/Navigation.js", "max_forks_repo_name": "ConfirmitASA/r-react-video", "max_forks_repo_forks_event_min_datetime": "2017-01-18T12:12:25.000Z", "max_forks_repo_forks_event_max_datetime": "2017-01-18T12:12:25.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 30.7619047619, "max_line_length": 71, "alphanum_fraction": 0.4736842105}
import React, { PureComponent } from 'react';

export default class Navigation extends PureComponent {
    render() {
        const { config } = this.props;
        if (config) {
            const pagination = config.pagination;
            if (pagination === 'continuous') {
                return this.continuousNavigation();
            } else {
                return this.pagingNavigation();
            }
        } else {
            return null
        }
    }

    continuousNavigation() {
        const { loadMore, disableNextButton, loading } = this.props;
        return !disableNextButton?(
            <div className="buttonRow" style={{ textAlign: 'center' }}>
                <span rel="button"
                    className="materialButton flat"
                    onClick={loadMore}
                    disabled={disableNextButton || loading}
                >{!loading?'Load more':'Loading...'}</span>
            </div>
        ):null
    }

    pagingNavigation() {
        const {
            loadPreviousPage,
            loadNextPage,
            disableNextButton,
            disablePrevButton,
            pageInfo,
            translate,
            loading,
            } = this.props;
        return (
            <div className="buttonRow">
                <span rel="button"
                    className="materialButton accent"
                    onClick={loadPreviousPage}
                    disabled={disablePrevButton||loading}
                >
                    {translate('REPORT_SINGLEVIEW_PREVIOUS')}
                </span>
                <span rel="button"
                    className="materialButton accent"
                    onClick={loadNextPage}
                    disabled={disableNextButton||loading}
                >
                    {translate('REPORT_SINGLEVIEW_NEXT')}
                </span>
                <span>{pageInfo}</span>
            </div>
        )
    }

}
