Files
ThreadNet-Web/src/components/views/elements/TextWithTooltip.tsx
T

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

31 lines
881 B
TypeScript
Raw Normal View History

/*
2024-09-09 14:57:16 +01:00
Copyright 2019-2024 New Vector Ltd.
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.
*/
2025-02-05 13:25:06 +00:00
import React, { type HTMLAttributes } from "react";
import { Tooltip } from "@vector-im/compound-web";
2021-09-15 21:06:06 +02:00
interface IProps extends HTMLAttributes<HTMLSpanElement> {
tooltip: string;
tooltipProps?: {
tabIndex?: number;
};
2021-09-15 21:06:06 +02:00
}
2021-12-09 11:47:50 +01:00
export default class TextWithTooltip extends React.Component<IProps> {
public render(): React.ReactNode {
const { className, children, tooltip, tooltipProps } = this.props;
2021-03-19 11:36:36 +00:00
return (
2024-04-12 14:56:23 +02:00
<Tooltip label={tooltip} placement="right">
<span className={className} tabIndex={tooltipProps?.tabIndex ?? 0}>
{children}
</span>
</Tooltip>
);
}
2019-05-13 18:31:43 -06:00
}