2023-05-24 10:20:39 +03:00
|
|
|
import { useCallback } from 'react';
|
|
|
|
|
2023-06-01 00:43:39 +03:00
|
|
|
import { useIntl, defineMessages } from 'react-intl';
|
2023-05-24 10:20:39 +03:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-06-01 00:43:39 +03:00
|
|
|
export const LoadGap: React.FC<Props> = ({ disabled, maxId, onClick }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
2023-05-25 14:03:37 +03:00
|
|
|
const handleClick = useCallback(() => {
|
|
|
|
onClick(maxId);
|
|
|
|
}, [maxId, onClick]);
|
2023-05-24 10:20:39 +03:00
|
|
|
|
2023-05-25 14:03:37 +03:00
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className='load-more load-gap'
|
|
|
|
disabled={disabled}
|
|
|
|
onClick={handleClick}
|
|
|
|
aria-label={intl.formatMessage(messages.load_more)}
|
|
|
|
>
|
|
|
|
<Icon id='ellipsis-h' />
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
};
|