~cytrogen/masto-fe

ref: 5c79cd6cf732c348b3cf63e9e6c79d189e42d08d masto-fe/app/javascript/flavours/glitch/components/load_gap.tsx -rw-r--r-- 775 bytes
5c79cd6c — Cytrogen [chore] Add .gstack/ to gitignore 4 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { useCallback } from "react";

import { useIntl, defineMessages } from "react-intl";

import { Icon } from "flavours/glitch/components/icon";

const messages = defineMessages({
  load_more: { id: "status.load_more", defaultMessage: "Load more" },
});

interface Props {
  disabled: boolean,
  maxId: string,
  onClick: (maxId: string) => void,
}

export const LoadGap: React.FC<Props> = ({ disabled, maxId, onClick }) => {
  const intl = useIntl();

  const handleClick = useCallback(() => {
    onClick(maxId);
  }, [maxId, onClick]);

  return (
    <button
      className='load-more load-gap'
      disabled={disabled}
      onClick={handleClick}
      aria-label={intl.formatMessage(messages.load_more)}
    >
      <Icon id='ellipsis-h' />
    </button>
  );
};