2023-05-24 08:20:39 +01:00
|
|
|
import { useCallback } from 'react';
|
|
|
|
|
2023-05-31 22:43:39 +01:00
|
|
|
import { useIntl, defineMessages } from 'react-intl';
|
2023-05-24 08:20:39 +01:00
|
|
|
|
2023-10-24 18:45:08 +01:00
|
|
|
import { ReactComponent as MoreHorizIcon } from '@material-symbols/svg-600/outlined/more_horiz.svg';
|
|
|
|
|
2023-05-24 08:20:39 +01: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-05-31 22:43:39 +01:00
|
|
|
export const LoadGap: React.FC<Props> = ({ disabled, maxId, onClick }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
2023-05-25 12:03:37 +01:00
|
|
|
const handleClick = useCallback(() => {
|
|
|
|
onClick(maxId);
|
|
|
|
}, [maxId, onClick]);
|
2023-05-24 08:20:39 +01:00
|
|
|
|
2023-05-25 12:03:37 +01:00
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className='load-more load-gap'
|
|
|
|
disabled={disabled}
|
|
|
|
onClick={handleClick}
|
|
|
|
aria-label={intl.formatMessage(messages.load_more)}
|
|
|
|
>
|
2023-10-24 18:45:08 +01:00
|
|
|
<Icon id='ellipsis-h' icon={MoreHorizIcon} />
|
2023-05-25 12:03:37 +01:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
};
|