Sidebar.jsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import React from 'react';
  2. // import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. import BacklogIcon from '@atlaskit/icon/glyph/backlog';
  5. import BoardIcon from '@atlaskit/icon/glyph/board';
  6. import GraphLineIcon from '@atlaskit/icon/glyph/graph-line';
  7. import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
  8. import { JiraWordmark } from '@atlaskit/logo';
  9. import {
  10. GroupHeading,
  11. HeaderSection,
  12. Item,
  13. LayoutManager,
  14. MenuSection,
  15. NavigationProvider,
  16. Separator,
  17. Wordmark,
  18. ThemeProvider, modeGenerator,
  19. } from '@atlaskit/navigation-next';
  20. import { createSubscribedElement } from './UnstatedUtils';
  21. import AppContainer from '../services/AppContainer';
  22. import SidebarNav from './Sidebar/SidebarNav';
  23. class Sidebar extends React.Component {
  24. static propTypes = {
  25. };
  26. state = {
  27. };
  28. renderSidebarContents = () => (
  29. <>
  30. <HeaderSection>
  31. { () => (
  32. <div className="grw-product-nav-header">
  33. <Wordmark wordmark={JiraWordmark} />
  34. </div>
  35. ) }
  36. </HeaderSection>
  37. <MenuSection>
  38. { () => (
  39. <div className="grw-product-nav-menu">
  40. <Item
  41. before={BacklogIcon}
  42. text="Backlog"
  43. isSelected
  44. />
  45. <Item
  46. before={BoardIcon}
  47. text="Active sprints"
  48. />
  49. <Item
  50. before={GraphLineIcon}
  51. text="Reports"
  52. />
  53. <Separator />
  54. <GroupHeading>Shortcuts</GroupHeading>
  55. <Item before={ShortcutIcon} text="Project space" />
  56. <Item before={ShortcutIcon} text="Looooooooooooooooooooooooooooooong Menu" />
  57. </div>
  58. ) }
  59. </MenuSection>
  60. </>
  61. );
  62. render() {
  63. return (
  64. <ThemeProvider
  65. theme={theme => ({
  66. ...theme,
  67. context: 'product',
  68. mode: modeGenerator({
  69. product: { text: '#ffffff', background: '#334455' },
  70. }),
  71. })}
  72. >
  73. <NavigationProvider>
  74. <LayoutManager
  75. globalNavigation={SidebarNav}
  76. productNavigation={() => null}
  77. containerNavigation={this.renderSidebarContents}
  78. experimental_flyoutOnHover
  79. experimental_alternateFlyoutBehaviour
  80. // experimental_fullWidthFlyout
  81. shouldHideGlobalNavShadow
  82. showContextualNavigation
  83. >
  84. </LayoutManager>
  85. </NavigationProvider>
  86. </ThemeProvider>
  87. );
  88. }
  89. }
  90. /**
  91. * Wrapper component for using unstated
  92. */
  93. const SidebarWrapper = (props) => {
  94. return createSubscribedElement(Sidebar, props, [AppContainer]);
  95. };
  96. export default withTranslation()(SidebarWrapper);