2019-03-20 17:42:28 +00:00
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
import { LocalizerType } from '../../types/Util';
|
|
|
|
|
2020-08-26 21:09:30 +00:00
|
|
|
export type Props = {
|
2019-05-31 22:42:01 +00:00
|
|
|
withNewMessages: boolean;
|
2019-03-20 17:42:28 +00:00
|
|
|
conversationId: string;
|
|
|
|
|
|
|
|
scrollDown: (conversationId: string) => void;
|
|
|
|
|
|
|
|
i18n: LocalizerType;
|
|
|
|
};
|
|
|
|
|
2020-09-14 19:51:27 +00:00
|
|
|
export const ScrollDownButton = ({
|
|
|
|
conversationId,
|
|
|
|
withNewMessages,
|
|
|
|
i18n,
|
|
|
|
scrollDown,
|
|
|
|
}: Props): JSX.Element => {
|
|
|
|
const altText = withNewMessages ? i18n('messagesBelow') : i18n('scrollDown');
|
2019-03-20 17:42:28 +00:00
|
|
|
|
2020-09-14 19:51:27 +00:00
|
|
|
return (
|
|
|
|
<div className="module-scroll-down">
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className={classNames(
|
|
|
|
'module-scroll-down__button',
|
|
|
|
withNewMessages ? 'module-scroll-down__button--new-messages' : null
|
|
|
|
)}
|
|
|
|
onClick={() => {
|
|
|
|
scrollDown(conversationId);
|
|
|
|
}}
|
|
|
|
title={altText}
|
|
|
|
>
|
|
|
|
<div className="module-scroll-down__icon" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|