Skip to content

Commit

Permalink
message loading skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
roienatan committed Oct 23, 2023
1 parent 3bed749 commit 7540c29
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/shared/components/Chat/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { StaticLinkType, isRtlText, getUserName } from "@/shared/utils";
import { convertBytes } from "@/shared/utils/convertBytes";
import { EditMessageInput } from "../EditMessageInput";
import { ChatMessageLinkify, InternalLinkData, Time } from "./components";
import { LoadingMessage } from "./components/LoadingMessage";
import { getTextFromTextEditorString } from "./utils";
import styles from "./ChatMessage.module.scss";

Expand Down Expand Up @@ -350,7 +351,9 @@ export default function ChatMessage({
[discussionMessage.files],
);

return (
return !messageText.length ? (
<LoadingMessage backgroundColor={isSystemMessage ? "#f3d4eb" : "#a75a93"} />
) : (
<li
id={discussionMessage.id}
className={classNames(styles.container, className)}
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";
import ContentLoader from "react-content-loader";

interface LoadingMessageProps {
backgroundColor: string;
}

const LoadingMessage = (props: LoadingMessageProps) => {
return (
<ContentLoader
speed={2}
width="100%"
height={22}
viewBox="0 0 296 22"
foregroundColor="#ecebeb"
{...props}
>
<rect x="0" y="0" rx="4" ry="4" width="100%" height="22" />
</ContentLoader>
);
};

export default LoadingMessage;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as LoadingMessage } from "./LoadingMessage";

0 comments on commit 7540c29

Please sign in to comment.