Item.js 981 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2017-2018 Jaco Greeff
  2. // This software may be modified and distributed under the terms
  3. // of the ISC license. See the LICENSE file for details.
  4. // @flow
  5. import type { BaseProps, Routes } from '../types';
  6. import './Item.css';
  7. import React from 'react';
  8. import { NavLink } from 'react-router-dom';
  9. import Icon from 'semantic-ui-react/dist/es/elements/Icon';
  10. import Menu from 'semantic-ui-react/dist/es/collections/Menu';
  11. type Props = BaseProps & Routes & {};
  12. export default function Item ({ className, i18n, icon, isExact, name, path, style, t }: Props) {
  13. return (
  14. <Menu.Item
  15. className={['portal--SideBar-Item', className].join(' ')}
  16. name={name}
  17. style={style}
  18. >
  19. <NavLink
  20. activeClassName='portal--SideBar-Item-NavLink-active'
  21. className='portal--SideBar-Item-NavLink'
  22. exact={isExact}
  23. to={path}
  24. >
  25. <Icon name={icon} /> {t(`sidebar.${name}`, i18n)}
  26. </NavLink>
  27. </Menu.Item>
  28. );
  29. }