import React, { useState } from 'react';
import {
  Nav,
  NavList,
  NavListItemAction,
  useNavList,
} from '@digigov/ui/navigation/NavList';

const links = [
  {
    name: 'home',
    href: '#home',
    label: 'Αρχική',
  },
  {
    name: 'educational',
    label: 'Εκπαιδευτικό υλικό',
    href: '#educational',
  },
  {
    name: 'news',
    href: '#news',
    label: 'Νέα',
  },
];

export const Vertical = (_: any) => {
  const layout = 'vertical';
  const { registerNavItem } = useNavList();
  const [useActive, setUseActive] = useState('');

  return (
    <Nav
      aria-orientation={layout || 'horizontal'}
      aria-label="navigation list"
      border={false}
    >
      <NavList layout={layout}>
        {links.map((item, key) => (
          <NavListItemAction
            {...registerNavItem(item)}
            key={key}
            active={item.name === useActive}
            onClick={() => setUseActive(item.name)}
          >
            {item.label}
          </NavListItemAction>
        ))}
      </NavList>
    </Nav>
  );
};

export default Vertical;
