PagePath.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { FC, useState } from 'react';
  2. import type { IPagePopulatedToShowRevision } from '@growi/core';
  3. import { usePageSelectModal } from '~/stores/modal';
  4. import { TextInputForPageTitleAndPath } from './TextInputForPageTitleAndPath';
  5. type Props = {
  6. currentPagePath: string
  7. currentPage: IPagePopulatedToShowRevision
  8. }
  9. export const PagePath: FC<Props> = (props) => {
  10. const { currentPagePath, currentPage } = props;
  11. const [isRenameInputShown, setRenameInputShown] = useState(false);
  12. const [isButtonsShown, setButtonShown] = useState(false);
  13. const { open: openPageSelectModal, close: closePageSelectModal } = usePageSelectModal();
  14. const stateHandler = { isRenameInputShown, setRenameInputShown };
  15. return (
  16. <>
  17. <div className="container">
  18. <div className="row">
  19. <div
  20. className="col-4"
  21. onMouseEnter={() => setButtonShown(true)}
  22. onMouseLeave={() => setButtonShown(false)}
  23. >
  24. <TextInputForPageTitleAndPath
  25. currentPagePath={currentPagePath}
  26. currentPage={currentPage}
  27. stateHandler={stateHandler}
  28. inputValue={currentPagePath}
  29. />
  30. </div>
  31. { isButtonsShown
  32. && (
  33. <>
  34. <div className="col-4">
  35. <button type="button">編集ボタン</button>
  36. </div>
  37. <div className="col-4">
  38. <button type="button" onClick={openPageSelectModal}>ページツリーボタン</button>
  39. </div>
  40. </>
  41. )}
  42. </div>
  43. </div>
  44. </>
  45. );
  46. };