import React, { Component } from 'react'

export default class Container extends Component {
    getMode(mode) {
        const c = 'container'
        const modes = ['xxs', 'xs', 'sm', 'md', 'fluid']
        if (modes.includes(mode)) {
            return `${c}-${mode}`
        }
        return c
    }

    render() {
        const { mode, className, children } = this.props

        let containerName = this.getMode(mode)
        if (className) {
            containerName = [containerName, className].join(' ')
        }

        return <section className={containerName}>{children}</section>
    }
}
