Commit 0525a91d authored by Chunchi Che's avatar Chunchi Che

update timeLine.tsx

parent dbc42578
Pipeline #20464 passed with stages
in 7 minutes and 1 second
import React from "react"; import React, { useEffect, useState } from "react";
import { Timeline } from "antd"; import { Timeline, TimelineItemProps } from "antd";
import { UserOutlined, SettingOutlined } from "@ant-design/icons"; import { UserOutlined, SettingOutlined } from "@ant-design/icons";
import { useAppSelector } from "../../hook";
import { selectChat } from "../../reducers/chatSlice";
const DuelTimeLine = () => ( const DuelTimeLine = () => {
<Timeline const [items, setItems] = useState<TimelineItemProps[]>([]);
items={[ const chat = useAppSelector(selectChat);
{
dot: <UserOutlined />, useEffect(() => {
children: "对手消息", setItems((prev) =>
color: "red", prev.concat([
}, {
{ dot: <SettingOutlined />,
dot: <UserOutlined />, children: chat,
children: "自己消息", color: "red",
color: "green", },
}, ])
{ );
dot: <SettingOutlined />, }, [chat]);
children: "系统消息",
}, return <Timeline items={items} />;
]} };
/>
);
export default DuelTimeLine; export default DuelTimeLine;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment