File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/react/src/components Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,18 @@ export type DiscordMessageProps = PropsWithChildren<{
19
19
} >
20
20
21
21
type MaybeTwemojiProps = PropsWithChildren < {
22
- useTwemoji ?: boolean
22
+ useTwemoji ?: boolean ,
23
+ jumboable ?: boolean
23
24
} >
24
25
25
26
26
27
function MaybeTwemoji ( {
27
28
useTwemoji,
29
+ jumboable,
28
30
children,
29
31
} : MaybeTwemojiProps ) : ReactElement {
30
32
if ( useTwemoji ) {
31
- return < Twemoji > { children } </ Twemoji >
33
+ return < Twemoji options = { { className : `emoji ${ jumboable ? ' jumboable' : '' } ` } } > { children } </ Twemoji >
32
34
}
33
35
return < > { children } </ >
34
36
}
@@ -111,8 +113,12 @@ export default function DiscordMessage({
111
113
if ( ephemeralMessage ) messageClasses += ' discord-ephemeral-highlight'
112
114
if ( highlightMessage && ! ephemeralMessage ) messageClasses += ' discord-mention-highlight'
113
115
116
+ const emoji_regex = / ^ (?: [ \p{ Extended_Pictographic} \u{1F3FB} - \u{1F3FF} \u{1F9B0} - \u{1F9B3} ] | \s ) * $ / ug
117
+
114
118
return (
115
- < MaybeTwemoji useTwemoji = { useTwemoji } >
119
+ < MaybeTwemoji useTwemoji = { useTwemoji } jumboable = { emoji_regex . test (
120
+ ( slots . default ? slots . default : '' ) . toString ( ) ,
121
+ ) } >
116
122
< div className = { messageClasses } >
117
123
{ slots . interactions }
118
124
< div className = "discord-message-content" >
You can’t perform that action at this time.
0 commit comments