@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 2.22 kB
Source Map (JSON)
{"version":3,"file":"FluentEmoji.mjs","names":["FluentEmoji: FC<FluentEmojiProps>","Center","Img"],"sources":["../../src/FluentEmoji/FluentEmoji.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC, useMemo, useState } from 'react';\n\nimport { useCdnFn } from '@/ConfigProvider';\nimport { Center } from '@/Flex';\nimport Img from '@/Img';\n\nimport { styles } from './style';\nimport type { FluentEmojiProps } from './type';\nimport { genEmojiUrl } from './utils';\n\nconst FluentEmoji: FC<FluentEmojiProps> = ({\n emoji,\n className,\n style,\n type = '3d',\n size = 40,\n unoptimized,\n ref,\n ...rest\n}) => {\n const [loadingFail, setLoadingFail] = useState(false);\n const genCdnUrl = useCdnFn();\n\n const emojiUrl = useMemo(() => genEmojiUrl(emoji, type), [type, emoji]);\n\n if (type === 'raw' || !emojiUrl || loadingFail)\n return (\n <Center\n className={cx(styles.container, className)}\n flex={'none'}\n height={size}\n ref={ref}\n role={'img'}\n style={{ fontSize: size * 0.9, ...style }}\n width={size}\n {...rest}\n >\n {emoji}\n </Center>\n );\n\n return (\n <Img\n alt={emoji}\n className={className}\n height={size}\n loading={'lazy'}\n onError={() => setLoadingFail(true)}\n ref={ref}\n src={genCdnUrl(emojiUrl)}\n style={{ flex: 'none', ...style }}\n unoptimized={unoptimized}\n width={size}\n {...rest}\n />\n );\n};\n\nFluentEmoji.displayName = 'FluentEmoji';\n\nexport default FluentEmoji;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAMA,eAAqC,EACzC,OACA,WACA,OACA,OAAO,MACP,OAAO,IACP,aACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM;CACrD,MAAM,YAAY,UAAU;CAE5B,MAAM,WAAW,cAAc,YAAY,OAAO,KAAK,EAAE,CAAC,MAAM,MAAM,CAAC;AAEvE,KAAI,SAAS,SAAS,CAAC,YAAY,YACjC,QACE,oBAACC;EACC,WAAW,GAAG,OAAO,WAAW,UAAU;EAC1C,MAAM;EACN,QAAQ;EACH;EACL,MAAM;EACN,OAAO;GAAE,UAAU,OAAO;GAAK,GAAG;GAAO;EACzC,OAAO;EACP,GAAI;YAEH;GACM;AAGb,QACE,oBAACC;EACC,KAAK;EACM;EACX,QAAQ;EACR,SAAS;EACT,eAAe,eAAe,KAAK;EAC9B;EACL,KAAK,UAAU,SAAS;EACxB,OAAO;GAAE,MAAM;GAAQ,GAAG;GAAO;EACpB;EACb,OAAO;EACP,GAAI;GACJ;;AAIN,YAAY,cAAc;AAE1B,0BAAe"}