MessageRich.tsx 875 B

12345678910111213141516171819202122232425262728
  1. import { View, Image } from "@tarojs/components";
  2. import ThinkAnimation from "../think-animation/index";
  3. import style from "./index.module.less";
  4. interface Props {
  5. loading?: boolean;
  6. data?: {
  7. avatar: string,
  8. name: string
  9. },
  10. children?: JSX.Element | JSX.Element[];
  11. }
  12. export default ({ loading, children, data }: Props) => {
  13. return (
  14. <View className="flex gap-8 items-start justify-end">
  15. <View className="flex justify-end">
  16. <View className={`${style.message} ${style.messageMeRich}`}>
  17. <View className={style.messageContent}>
  18. {loading && <ThinkAnimation></ThinkAnimation>}
  19. {children}
  20. </View>
  21. </View>
  22. </View>
  23. <View className={style.avatarContainer}>
  24. {data && <Image className={style.avatar} src={data?.avatar} mode="widthFix"></Image>}
  25. </View>
  26. </View>
  27. );
  28. };