<script>
import Item from './item';
export default {
  functional: true,
  props: {
    years: Array,
    onClick: Function,
    onMouseEnter: { type: Function, default: () => {} }
  },
  render(h, ctx) {
    return (
      <table class={['hive-date-year', ctx.data.class]}>
        <tbody>
          {
            ctx.props.years.map((year, i) => (
              <tr key={i}>
                {
                  year.map((y, j) => (
                    h(Item, {
                      class: 'hive-date-year__item',
                      key: j,
                      props: {
                        onClick: ctx.props.onClick,
                        onMouseEnter: ctx.props.onMouseEnter,
                        ...y
                      }
                    })
                  ))
                }
              </tr>
            ))
          }
        </tbody>
      </table>
    );
  }
};
</script>
