feat: markdown msg in widget
This commit is contained in:
@@ -98,9 +98,10 @@ const Login = () => {
|
||||
{/* input email as username */}
|
||||
<Input required placeholder="Email" type="email" name="username" />
|
||||
<StyledButton
|
||||
style={{ backgroundColor: color, color: fgColor }}
|
||||
disabled={isLoading}
|
||||
type="submit"
|
||||
className={clsx("small", `bg-[${color}] text-[${fgColor}]`)}
|
||||
className={clsx("small")}
|
||||
>
|
||||
{t("start_chat")}
|
||||
</StyledButton>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// import React from 'react';
|
||||
// import clsx from "clsx";
|
||||
|
||||
// import { useWidget } from "../../WidgetContext";
|
||||
import MarkdownRender from "@/components/MarkdownRender";
|
||||
|
||||
type Props = {
|
||||
content: string;
|
||||
};
|
||||
|
||||
const Markdown = ({ content }: Props) => {
|
||||
return <MarkdownRender content={content} />;
|
||||
};
|
||||
|
||||
export default Markdown;
|
||||
@@ -1,5 +1,4 @@
|
||||
import { memo } from "react";
|
||||
import clsx from "clsx";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
|
||||
@@ -8,6 +7,8 @@ import Text from "./Text";
|
||||
import Image from "./Image";
|
||||
import { ContentType } from "@/types/message";
|
||||
import { shallowEqual } from "react-redux";
|
||||
import Markdown from "./Markdown";
|
||||
import { cn } from "@/utils";
|
||||
|
||||
dayjs.extend(localizedFormat);
|
||||
|
||||
@@ -41,6 +42,9 @@ const Index = (props: IWidgetMessage) => {
|
||||
case "text/plain":
|
||||
contentContainer = <Text sending={sending} content={content} host={host} uid={uid} />;
|
||||
break;
|
||||
case "text/markdown":
|
||||
contentContainer = <Markdown content={content} />;
|
||||
break;
|
||||
case "vocechat/file":
|
||||
{
|
||||
console.log("image file", content);
|
||||
@@ -54,7 +58,7 @@ const Index = (props: IWidgetMessage) => {
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
className={cn(
|
||||
"group flex mb-3",
|
||||
host ? "relative justify-start items-start" : "items-center justify-end px-3"
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user