import React from 'react';
import UI from 'cem/components/ui';

import { Link } from 'react-router';

import styles from 'cem/styles/id/main';

const { Grid, Table } = UI;

export default ({ entries }) => (
  <Grid.Container fluid>
    <Grid.Row>
      <section className={styles.section}>
        <Grid.Row>
          <Grid.Col xs="20" className={styles.wrapper}>
            <Table.Container width="100%">
              {entries.length > 0 &&
                <Table.Row>
                  <Table.Heading>Название словаря</Table.Heading>
                </Table.Row>
              }
              {entries.map((entry, index) =>
                <Table.Row key={index}>
                  <Table.Cell className={styles.fixWidth}>
                    <Link className={styles.link} to={`/settings/dictionaries/${entry.name}`}>{entry.title}</Link>
                  </Table.Cell>
                </Table.Row>)
              }
            </Table.Container>
          </Grid.Col>
        </Grid.Row>
      </section>
    </Grid.Row>
  </Grid.Container>
);
