2
0

BookmarkFolder.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from 'react';
  2. import { useTranslation } from 'next-i18next';
  3. import ClosableTextInput from '~/components/Common/ClosableTextInput';
  4. import FolderPlusIcon from '~/components/Icons/FolderPlusIcon';
  5. import BookmarkFolderTree from './BookmarkFolderTree';
  6. type Props = {
  7. onClickNewFolder: () => void
  8. isRenameInputShown: boolean
  9. folderName: string
  10. onClickOutside: () => void
  11. onPressEnter: (folderName: string) => void
  12. }
  13. const BookmarkFolder = (props: Props): JSX.Element => {
  14. const {
  15. onClickNewFolder, isRenameInputShown, folderName, onClickOutside, onPressEnter,
  16. } = props;
  17. const { t } = useTranslation();
  18. return (
  19. <>
  20. <div className="col-8 mb-2 ">
  21. <button
  22. className="btn btn-block btn-outline-secondary rounded-pill d-flex justify-content-start align-middle"
  23. onClick={onClickNewFolder}
  24. >
  25. <FolderPlusIcon />
  26. <span className="mx-2 ">New Folder</span>
  27. </button>
  28. </div>
  29. {
  30. isRenameInputShown && (
  31. <div className="col-10 mb-2 ml-2 ">
  32. <ClosableTextInput
  33. value={folderName}
  34. placeholder={t('Input Folder name')}
  35. onClickOutside={onClickOutside}
  36. onPressEnter={onPressEnter}
  37. />
  38. </div>
  39. )
  40. }
  41. <BookmarkFolderTree />
  42. </>
  43. );
  44. };
  45. export default BookmarkFolder;