UsersHomePageFooter.tsx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React, { useState } from 'react';
  2. import { useTranslation } from 'next-i18next';
  3. import { RecentlyCreatedIcon } from '~/components/Icons/RecentlyCreatedIcon';
  4. import { RecentCreated } from '~/components/RecentCreated/RecentCreated';
  5. import styles from '~/components/UsersHomePageFooter.module.scss';
  6. import { BookmarkFolderTree } from './Bookmarks/BookmarkFolderTree';
  7. import { CompressIcon } from './Icons/CompressIcon';
  8. import { ExpandIcon } from './Icons/ExpandIcon';
  9. export type UsersHomePageFooterProps = {
  10. creatorId: string,
  11. }
  12. export const UsersHomePageFooter = (props: UsersHomePageFooterProps): JSX.Element => {
  13. const { t } = useTranslation();
  14. const { creatorId } = props;
  15. const [isExpanded, setIsExpanded] = useState<boolean>(false);
  16. return (
  17. <div className={`container-lg user-page-footer py-5 ${styles['user-page-footer']}`}>
  18. <div className="grw-user-page-list-m d-edit-none">
  19. <h2 id="bookmarks-list" className="grw-user-page-header border-bottom pb-2 mb-3 d-flex">
  20. <i style={{ fontSize: '1.3em' }} className="fa fa-fw fa-bookmark-o"></i>
  21. {t('footer.bookmarks')}
  22. <span className="ml-auto pl-2 ">
  23. <button
  24. className={`btn btn-sm grw-expand-compress-btn ${isExpanded ? 'active' : ''}`}
  25. onClick={() => setIsExpanded(!isExpanded)}
  26. >
  27. { isExpanded
  28. ? <ExpandIcon/>
  29. : <CompressIcon />
  30. }
  31. </button>
  32. </span>
  33. </h2>
  34. {/* TODO: In bookmark folders v1, the button to create a new folder does not exist. The button should be included in the bookmark component. */}
  35. <div className={`${isExpanded ? `${styles['grw-bookarks-contents-expanded']}` : `${styles['grw-bookarks-contents-compressed']}`}`}>
  36. <BookmarkFolderTree isUserHomePage={true} />
  37. </div>
  38. </div>
  39. <div className="grw-user-page-list-m mt-5 d-edit-none">
  40. <h2 id="recently-created-list" className="grw-user-page-header border-bottom pb-2 mb-3">
  41. <i id="recent-created-icon" className="mr-1"><RecentlyCreatedIcon /></i>
  42. {t('footer.recently_created')}
  43. </h2>
  44. <div id="user-created-list" className={`page-list ${styles['page-list']}`}>
  45. <RecentCreated userId={creatorId} />
  46. </div>
  47. </div>
  48. </div>
  49. );
  50. };