2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2019-2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
import type { ButtonHTMLAttributes } from 'react';
|
2019-05-16 22:32:11 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import classNames from 'classnames';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { LocalizerType } from '../../types/Util';
|
2019-05-16 22:32:11 +00:00
|
|
|
|
|
|
|
export type OwnProps = {
|
|
|
|
readonly installed: boolean;
|
|
|
|
readonly i18n: LocalizerType;
|
|
|
|
readonly blue?: boolean;
|
|
|
|
};
|
|
|
|
|
2022-06-07 00:48:02 +00:00
|
|
|
export type Props = OwnProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
2019-05-16 22:32:11 +00:00
|
|
|
|
|
|
|
export const StickerPackInstallButton = React.forwardRef<
|
|
|
|
HTMLButtonElement,
|
|
|
|
Props
|
|
|
|
>(({ i18n, installed, blue, ...props }: Props, ref) => (
|
|
|
|
<button
|
2020-09-14 22:14:03 +00:00
|
|
|
type="button"
|
2019-05-16 22:32:11 +00:00
|
|
|
ref={ref}
|
|
|
|
className={classNames({
|
|
|
|
'module-sticker-manager__install-button': true,
|
|
|
|
'module-sticker-manager__install-button--blue': blue,
|
|
|
|
})}
|
2020-09-14 22:14:03 +00:00
|
|
|
aria-label={i18n('stickers--StickerManager--Install')}
|
2019-05-16 22:32:11 +00:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{installed
|
|
|
|
? i18n('stickers--StickerManager--Uninstall')
|
|
|
|
: i18n('stickers--StickerManager--Install')}
|
|
|
|
</button>
|
|
|
|
));
|