2019-01-22 14:39:03 +01:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2019-2024 New Vector Ltd.
|
2019-01-22 14:39:03 +01:00
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2019-01-22 14:39:03 +01:00
|
|
|
*/
|
|
|
|
|
|
2021-08-14 10:22:43 +02:00
|
|
|
import React from "react";
|
2021-10-22 17:23:32 -05:00
|
|
|
import classNames from "classnames";
|
|
|
|
|
|
2019-01-22 14:39:03 +01:00
|
|
|
import { _t } from "../../../languageHandler";
|
2025-02-05 13:25:06 +00:00
|
|
|
import AccessibleButton, { type ButtonEvent } from "../elements/AccessibleButton";
|
2019-01-22 14:39:03 +01:00
|
|
|
|
2021-08-14 10:22:43 +02:00
|
|
|
interface IProps {
|
2022-02-08 17:35:03 +00:00
|
|
|
numUnreadMessages?: number;
|
2021-08-14 10:22:43 +02:00
|
|
|
highlight: boolean;
|
2023-05-12 09:49:37 +01:00
|
|
|
onScrollToBottomClick: (e: ButtonEvent) => void;
|
2021-08-14 10:22:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const JumpToBottomButton: React.FC<IProps> = (props) => {
|
2020-07-03 14:27:55 -04:00
|
|
|
const className = classNames({
|
|
|
|
|
mx_JumpToBottomButton: true,
|
|
|
|
|
mx_JumpToBottomButton_highlight: props.highlight,
|
|
|
|
|
});
|
2019-01-22 14:39:03 +01:00
|
|
|
let badge;
|
|
|
|
|
if (props.numUnreadMessages) {
|
2021-07-19 22:43:11 +01:00
|
|
|
badge = <div className="mx_JumpToBottomButton_badge">{props.numUnreadMessages}</div>;
|
2019-01-22 14:39:03 +01:00
|
|
|
}
|
2020-07-03 14:27:55 -04:00
|
|
|
return (
|
|
|
|
|
<div className={className}>
|
2021-07-23 10:23:45 +01:00
|
|
|
<AccessibleButton
|
|
|
|
|
className="mx_JumpToBottomButton_scrollDown"
|
2023-09-29 08:49:26 +01:00
|
|
|
title={_t("room|jump_to_bottom_button")}
|
2021-07-23 10:23:45 +01:00
|
|
|
onClick={props.onScrollToBottomClick}
|
|
|
|
|
/>
|
2019-01-22 14:39:03 +01:00
|
|
|
{badge}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
2021-08-14 10:22:43 +02:00
|
|
|
|
|
|
|
|
export default JumpToBottomButton;
|