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