chore: message list use markdown

This commit is contained in:
molvqingtai 2023-08-03 04:38:36 +08:00
parent a9c055b467
commit 1212f3811f
2 changed files with 10 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/Avatar'
import LikeButton from '@/components/LikeButton' import LikeButton from '@/components/LikeButton'
import { type Message } from '@/domain/MessageList' import { type Message } from '@/domain/MessageList'
import { Markdown } from '@/components/ui/Markdown'
export interface MessageItemProps { export interface MessageItemProps {
data: Message data: Message
@ -39,7 +40,7 @@ const MessageItem: FC<MessageItemProps> = ({ data }) => {
</div> </div>
<div> <div>
<div className="pb-2"> <div className="pb-2">
<pre className="text-sm">{formatData.body}</pre> <Markdown>{formatData.body}</Markdown>
</div> </div>
<div className="grid grid-flow-col justify-end gap-x-2 leading-none"> <div className="grid grid-flow-col justify-end gap-x-2 leading-none">
<LikeButton <LikeButton

View file

@ -5,6 +5,7 @@ import { Button } from '@/components/ui/Button'
import MessageInput from '@/components/MessageInput' import MessageInput from '@/components/MessageInput'
import MessageInputDomain from '@/domain/MessageInput' import MessageInputDomain from '@/domain/MessageInput'
import MessageListDomain from '@/domain/MessageList' import MessageListDomain from '@/domain/MessageList'
import { MESSAGE_MAX_LENGTH } from '@/constants'
const Footer: FC = () => { const Footer: FC = () => {
const send = useRemeshSend() const send = useRemeshSend()
@ -36,7 +37,13 @@ const Footer: FC = () => {
return ( return (
<div className="grid gap-y-2 p-4"> <div className="grid gap-y-2 p-4">
<MessageInput value={message} preview={isPreview} onEnter={handleSend} onInput={handleInput}></MessageInput> <MessageInput
value={message}
preview={isPreview}
onEnter={handleSend}
onInput={handleInput}
maxLength={MESSAGE_MAX_LENGTH}
></MessageInput>
<div className="grid grid-cols-[auto_auto_1fr] items-center justify-items-end"> <div className="grid grid-cols-[auto_auto_1fr] items-center justify-items-end">
<Button variant="ghost" size="icon"> <Button variant="ghost" size="icon">
<SmileIcon size={20} /> <SmileIcon size={20} />