| 
									
										
										
										
											2020-10-30 15:34:04 -05:00
										 |  |  | // Copyright 2020 Signal Messenger, LLC
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | import * as React from 'react'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { text } from '@storybook/addon-knobs'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { Props } from './Emojify'; | 
					
						
							|  |  |  | import { Emojify } from './Emojify'; | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-06 20:48:02 -04:00
										 |  |  | export default { | 
					
						
							|  |  |  |   title: 'Components/Conversation/Emojify', | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | const createProps = (overrideProps: Partial<Props> = {}): Props => ({ | 
					
						
							|  |  |  |   renderNonEmoji: overrideProps.renderNonEmoji, | 
					
						
							|  |  |  |   sizeClass: overrideProps.sizeClass, | 
					
						
							|  |  |  |   text: text('text', overrideProps.text || ''), | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function EmojiOnly(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function SkinColorModifier(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '👍🏾', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function Jumbo(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							| 
									
										
										
										
											2021-10-06 13:37:53 -04:00
										 |  |  |     sizeClass: 'max', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-10-06 13:37:53 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function ExtraLarge(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2021-10-06 13:37:53 -04:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							|  |  |  |     sizeClass: 'extra-large', | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function Large(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							|  |  |  |     sizeClass: 'large', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function Medium(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							|  |  |  |     sizeClass: 'medium', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function Small(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '😹😹😹', | 
					
						
							|  |  |  |     sizeClass: 'small', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function PlusText(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: 'this 😹 cat 😹 is 😹 so 😹 joyful', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function AllTextNoEmoji(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: 'this cat is so joyful', | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-06-06 20:48:02 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | AllTextNoEmoji.story = { | 
					
						
							|  |  |  |   name: 'All Text, No Emoji', | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function CustomTextRender(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2020-08-21 10:27:37 -07:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: 'this 😹 cat 😹 is 😹 so 😹 joyful', | 
					
						
							|  |  |  |     renderNonEmoji: ({ text: theText, key }) => ( | 
					
						
							|  |  |  |       <div key={key} style={{ backgroundColor: 'aquamarine' }}> | 
					
						
							|  |  |  |         {theText} | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     ), | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-08-30 11:39:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function TensOfThousandsOfEmoji(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2021-08-30 11:39:03 -05:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '💅'.repeat(40000), | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-08-30 11:39:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-06 20:48:02 -04:00
										 |  |  | TensOfThousandsOfEmoji.story = { | 
					
						
							|  |  |  |   name: 'Tens of thousands of emoji', | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function TensOfThousandsOfEmojiInterspersedWithText(): JSX.Element { | 
					
						
							| 
									
										
										
										
											2021-08-30 11:39:03 -05:00
										 |  |  |   const props = createProps({ | 
					
						
							|  |  |  |     text: '💅 hi '.repeat(40000), | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return <Emojify {...props} />; | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-06-06 20:48:02 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | TensOfThousandsOfEmojiInterspersedWithText.story = { | 
					
						
							|  |  |  |   name: 'Tens of thousands of emoji, interspersed with text', | 
					
						
							|  |  |  | }; |