import React from 'react';
import {withNamespaces} from "react-i18next";

import {injectSheet} from '../../lib/theme';
import featureManager from '../../lib/FeatureManager';
import ArticleCreate from './ArticleCreate';

const styling = () => ({});

class Content extends React.Component {
    render() {
        const {t} = this.props;
        return (
            <div>
                <h1>{t('title')}</h1>
                {this.props.match.params.section ?
                    <p>{t('choosen-section-is')}{this.props.match.params.section}</p> :
                    <p>{t('choose-section')}</p>}

                {this.props.match.params.section && featureManager.isAbilityEnabled('content', 'create-article') ?
                    <React.Fragment>
                        <h2>{t('create-article-in-section')}</h2>
                        <ArticleCreate section={this.props.match.params.section}/>
                    </React.Fragment> : null}
            </div>
        );
    }
}

export default withNamespaces('page--content-section')(injectSheet(styling)(Content));
