Add emoji support to CollectionCardComponent
This commit is contained in:
parent
971b0ca366
commit
9f1d2878df
1 changed files with 11 additions and 6 deletions
|
|
@ -30,6 +30,8 @@ export default function CollectionCardComponent({
|
||||||
}) {
|
}) {
|
||||||
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
const addFlow = useFlowsManagerStore((state) => state.addFlow);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const emojiRegex = /\p{Emoji}/u;
|
||||||
|
const isEmoji= (str:string)=> emojiRegex.test(str);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
|
@ -41,17 +43,20 @@ export default function CollectionCardComponent({
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<div>
|
<div>
|
||||||
<CardTitle className="flex w-full items-center justify-between gap-3 text-xl">
|
<CardTitle className="flex w-full items-center justify-between gap-3 text-xl">
|
||||||
{flow.icon && (
|
{flow.icon && isEmoji(flow.icon) && (
|
||||||
<div className="flex-shrink-0 h-7 w-7">
|
<div className="rounded-md p-2 flex align-middle items-center justify-center" style={{backgroundColor:flow.icon_bg_color}}>
|
||||||
{flow.icon}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div className="pl-0.5 h-7 w-7">
|
||||||
|
{flow.icon}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{!flow.icon && <IconComponent
|
{(!flow.icon || !isEmoji(flow.icon)) && <IconComponent
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex-shrink-0 h-7 w-7 text-flow-icon",
|
"flex-shrink-0 h-7 w-7 text-flow-icon",
|
||||||
)}
|
)}
|
||||||
name="Group"
|
name={flow.icon || "Group"}
|
||||||
/>}
|
/>}
|
||||||
<ShadTooltip content={flow.name}>
|
<ShadTooltip content={flow.name}>
|
||||||
<div className="w-full truncate">{flow.name}</div>
|
<div className="w-full truncate">{flow.name}</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue