Entry.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2017-2019 @polkadot/app-dashboard authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { Route } from '@polkadot/apps-routing/types';
  5. import { I18nProps } from '@polkadot/react-components/types';
  6. import React from 'react';
  7. import { Link } from 'react-router-dom';
  8. import styled from 'styled-components';
  9. import { Icon } from '@polkadot/react-components';
  10. import translate from './translate';
  11. interface Props extends I18nProps {
  12. route: Route;
  13. }
  14. class Entry extends React.PureComponent<Props> {
  15. public render (): React.ReactNode {
  16. const { className, route: { i18n, icon, name }, t } = this.props;
  17. return (
  18. <div className={className}>
  19. <Link to={`/${name}`}>
  20. <Icon
  21. name={icon}
  22. size='massive'
  23. />
  24. <div className='name'>
  25. {t(`entry.${name}`, i18n)}
  26. </div>
  27. </Link>
  28. </div>
  29. );
  30. }
  31. }
  32. export default translate(styled(Entry)`
  33. .name {
  34. margin-top: 0.75rem;
  35. }
  36. `);