~cytrogen/masto-fe

ref: 110c8fb8ccb1363f649d3eb30ca822f415145e6a masto-fe/app/javascript/mastodon/components/load_gap.tsx -rw-r--r-- 768 bytes
110c8fb8 — Sqx. Flann [bugfix] account for data structure change in instance API fallback (#63) 9 months 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 'mastodon/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>
  );
};