ContentLinkButtons.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React from 'react';
  2. import type { IUserHasId } from '@growi/core';
  3. import { Link as ScrollLink } from 'react-scroll';
  4. import { RecentlyCreatedIcon } from '~/components/Icons/RecentlyCreatedIcon';
  5. import styles from './ContentLinkButtons.module.scss';
  6. const BookMarkLinkButton = React.memo(() => {
  7. return (
  8. <ScrollLink to="bookmarks-list" offset={-120}>
  9. <button
  10. type="button"
  11. className="btn btn-outline-secondary btn-sm px-2"
  12. >
  13. <span className="material-symbols-outlined">bookmark</span>
  14. <span>Bookmarks</span>
  15. </button>
  16. </ScrollLink>
  17. );
  18. });
  19. BookMarkLinkButton.displayName = 'BookMarkLinkButton';
  20. const RecentlyCreatedLinkButton = React.memo(() => {
  21. return (
  22. <ScrollLink to="recently-created-list" offset={-120}>
  23. <button
  24. type="button"
  25. className="btn btn-outline-secondary btn-sm px-3"
  26. >
  27. <i className={`${styles['grw-icon-container-recently-created']} grw-icon-container-recently-created me-2`}><RecentlyCreatedIcon /></i>
  28. <span>Recently Created</span>
  29. </button>
  30. </ScrollLink>
  31. );
  32. });
  33. RecentlyCreatedLinkButton.displayName = 'RecentlyCreatedLinkButton';
  34. export type ContentLinkButtonsProps = {
  35. author?: IUserHasId,
  36. }
  37. export const ContentLinkButtons = (props: ContentLinkButtonsProps): JSX.Element => {
  38. const { author } = props;
  39. if (author == null || author.status === 4) {
  40. return <></>;
  41. }
  42. return (
  43. <div className="mt-3 d-flex justify-content-between">
  44. <BookMarkLinkButton />
  45. <RecentlyCreatedLinkButton />
  46. </div>
  47. );
  48. };