File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change
1
+ import { ComponentProps } from "react"
1
2
import dynamic from "next/dynamic"
2
- import type { BaseProps } from "react-emoji-render"
3
- import { Box , type BoxProps } from "@chakra-ui/react"
4
3
4
+ import { cn } from "@/lib/utils/cn"
5
5
import { IS_DEV } from "@/lib/utils/env"
6
6
7
7
const Twemoji = dynamic (
8
8
( ) => import ( "react-emoji-render" ) . then ( ( mod ) => mod . Twemoji ) ,
9
9
{ ssr : false }
10
10
)
11
11
12
- export type EmojiProps = Omit < BoxProps , "children" > & BaseProps
12
+ export type EmojiProps = ComponentProps < typeof Twemoji >
13
13
14
- const Emoji = ( props : EmojiProps ) => (
15
- < Box
16
- as = { Twemoji }
14
+ const Emoji = ( { className, ...props } : EmojiProps ) => (
15
+ < Twemoji
17
16
// The emoji lib is switching the protocol based on the existence of the
18
17
// `location` object. That condition in DEV causes hydration mismatches.
19
18
// https://github.com/tommoor/react-emoji-render/blob/master/src/index.js#L8
20
19
// Hence, here we are defining how we want it to handle the protocol to
21
20
// avoid differences in SSR
22
21
options = { { protocol : IS_DEV ? "http" : "https" } }
23
22
svg
24
- display = "inline-block"
25
- lineHeight = "none"
26
- sx = { {
27
- "& > img" : {
28
- margin : "0 !important" ,
29
- display : "initial" ,
30
- } ,
31
- } }
23
+ className = { cn ( "inline-block leading-none [&>img]:!m-0" , className ) }
32
24
{ ...props }
33
25
/>
34
26
)
You can’t perform that action at this time.
0 commit comments