You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GlobalNav.tsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import * as React from 'react';
  21. import EmbedDocsPopupHelper from '../../../../components/embed-docs-modal/EmbedDocsPopupHelper';
  22. import { CurrentUser } from '../../../../types/users';
  23. import withCurrentUserContext from '../../current-user/withCurrentUserContext';
  24. import GlobalSearch from '../../global-search/GlobalSearch';
  25. import GlobalNavMenu from './GlobalNavMenu';
  26. import { GlobalNavUser } from './GlobalNavUser';
  27. import MainSonarQubeBar from './MainSonarQubeBar';
  28. export interface GlobalNavProps {
  29. currentUser: CurrentUser;
  30. location: { pathname: string };
  31. }
  32. export function GlobalNav(props: GlobalNavProps) {
  33. const { currentUser, location } = props;
  34. return (
  35. <MainSonarQubeBar>
  36. <div className="sw-flex" id="global-navigation">
  37. <div className="it__global-navbar-menu sw-flex sw-justify-start sw-items-center sw-flex-1">
  38. <GlobalNavMenu currentUser={currentUser} location={location} />
  39. <div className="sw-px-8 sw-flex-1">
  40. <GlobalSearch />
  41. </div>
  42. </div>
  43. <div className="sw-flex sw-items-center sw-ml-2">
  44. <EmbedDocsPopupHelper />
  45. <div className="sw-ml-4">
  46. <GlobalNavUser />
  47. </div>
  48. </div>
  49. </div>
  50. </MainSonarQubeBar>
  51. );
  52. }
  53. export default withCurrentUserContext(GlobalNav);