signal-desktop/ts/components/InContactsIcon.tsx

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-01-03 11:55:46 -08:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 15:34:04 -05:00
// SPDX-License-Identifier: AGPL-3.0-only
2020-07-23 18:35:32 -07:00
import React from 'react';
2020-11-20 14:39:50 -05:00
import classNames from 'classnames';
2020-07-23 18:35:32 -07:00
2020-11-19 13:11:35 -05:00
import { Tooltip } from './Tooltip';
import type { LocalizerType } from '../types/Util';
2020-07-23 18:35:32 -07:00
type PropsType = {
2020-11-20 14:39:50 -05:00
className?: string;
tooltipContainerRef?: React.RefObject<HTMLElement>;
2020-07-23 18:35:32 -07:00
i18n: LocalizerType;
};
2022-11-17 16:45:19 -08:00
export function InContactsIcon(props: PropsType): JSX.Element {
const { className, i18n, tooltipContainerRef } = props;
2020-07-23 18:35:32 -07:00
2020-09-11 17:46:52 -07:00
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
2020-07-23 18:35:32 -07:00
return (
<Tooltip
2023-03-29 17:03:25 -07:00
content={i18n('icu:contactInAddressBook')}
popperModifiers={[
{
name: 'preventOverflow',
options: {
boundary: tooltipContainerRef?.current || undefined,
},
},
]}
>
<span
2023-03-29 17:03:25 -07:00
aria-label={i18n('icu:contactInAddressBook')}
className={classNames('module-in-contacts-icon__icon', className)}
role="img"
tabIndex={0}
/>
</Tooltip>
2020-07-23 18:35:32 -07:00
);
2020-09-11 17:46:52 -07:00
/* eslint-enable jsx-a11y/no-noninteractive-tabindex */
2022-11-17 16:45:19 -08:00
}