// @flow
/* eslint react/no-array-index-key: 0 */
import React from 'react';
import type { FormListProps } from './form-list.proptypes';
import { FormBox, FormRow } from '../forms.common';

export const FormList = ({ items }: FormListProps) => (
  <FormBox>
    {items.map((item, index) => (
      <FormRow
        key={index}
        isLast={index + 1 === items.length}
        stacked="column"
        justify="center"
      >
        {item}
      </FormRow>
    ))}
  </FormBox>
);

FormList.displayName = 'FormList';
