GrowiNavbarBottom.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import React, { type JSX, useCallback } from 'react';
  2. import { GroundGlassBar } from '~/components/Navbar/GroundGlassBar';
  3. import { useSearchModalActions } from '~/features/search/client/states/modal/search';
  4. import { useIsSearchPage } from '~/states/context';
  5. import { useCurrentPagePath } from '~/states/page';
  6. import { usePageCreateModalActions } from '~/states/ui/modal/page-create';
  7. import { useDrawerOpened } from '~/states/ui/sidebar';
  8. import styles from './GrowiNavbarBottom.module.scss';
  9. export const GrowiNavbarBottom = (): JSX.Element => {
  10. const [isDrawerOpened, setIsDrawerOpened] = useDrawerOpened();
  11. const { open: openCreateModal } = usePageCreateModalActions();
  12. const currentPagePath = useCurrentPagePath();
  13. const isSearchPage = useIsSearchPage();
  14. const { open: openSearchModal } = useSearchModalActions();
  15. const searchButtonClickHandler = useCallback(() => {
  16. openSearchModal();
  17. }, [openSearchModal]);
  18. return (
  19. <GroundGlassBar
  20. className={`
  21. ${styles['grw-navbar-bottom']}
  22. ${isDrawerOpened ? styles['grw-navbar-bottom-drawer-opened'] : ''}
  23. d-md-none d-edit-none d-print-none fixed-bottom`}
  24. >
  25. <div className="navbar navbar-expand px-4 px-sm-5">
  26. <ul className="navbar-nav flex-grow-1 d-flex align-items-center justify-content-between">
  27. <li className="nav-item">
  28. <button
  29. type="button"
  30. className="nav-link btn-lg"
  31. onClick={() => setIsDrawerOpened(true)}
  32. >
  33. <span className="material-symbols-outlined fs-2">reorder</span>
  34. </button>
  35. </li>
  36. <li className="nav-item">
  37. <button
  38. type="button"
  39. className="nav-link btn-lg"
  40. onClick={() => openCreateModal(currentPagePath || '')}
  41. >
  42. <span className="material-symbols-outlined fs-2">edit</span>
  43. </button>
  44. </li>
  45. {!isSearchPage && (
  46. <li className="nav-item">
  47. <button
  48. type="button"
  49. className="nav-link btn-lg"
  50. onClick={searchButtonClickHandler}
  51. >
  52. <span className="material-symbols-outlined fs-2">search</span>
  53. </button>
  54. </li>
  55. )}
  56. <li className="nav-item">
  57. <button
  58. type="button"
  59. className="nav-link btn-lg"
  60. onClick={() => {}}
  61. aria-label="Notifications"
  62. >
  63. <span className="material-symbols-outlined fs-2">
  64. notifications
  65. </span>
  66. </button>
  67. </li>
  68. </ul>
  69. </div>
  70. </GroundGlassBar>
  71. );
  72. };