Files
ThreadNet-Web/src/components/views/rooms/JumpToBottomButton.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.2 KiB
TypeScript
Raw Normal View History

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
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 {
numUnreadMessages?: number;
2021-08-14 10:22:43 +02:00
highlight: boolean;
onScrollToBottomClick: (e: ButtonEvent) => void;
2021-08-14 10:22:43 +02:00
}
const JumpToBottomButton: React.FC<IProps> = (props) => {
const className = classNames({
mx_JumpToBottomButton: true,
mx_JumpToBottomButton_highlight: props.highlight,
});
2019-01-22 14:39:03 +01:00
let badge;
if (props.numUnreadMessages) {
badge = <div className="mx_JumpToBottomButton_badge">{props.numUnreadMessages}</div>;
2019-01-22 14:39:03 +01:00
}
return (
<div className={className}>
2021-07-23 10:23:45 +01:00
<AccessibleButton
className="mx_JumpToBottomButton_scrollDown"
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;