Files
5chan/src/components/StateLabel.jsx
T

28 lines
672 B
React
Raw Normal View History

2023-06-01 17:25:21 +02:00
import React from "react";
2023-06-01 10:43:17 +02:00
import { useComment } from "@plebbit/plebbit-react-hooks";
2023-06-01 17:24:44 +02:00
import useStateString from "../hooks/useStateString";
2023-06-01 10:43:17 +02:00
const StateLabel = ({ commentCid, className }) => {
const comment = useComment({commentCid});
2023-06-01 17:24:44 +02:00
const stateString = useStateString(comment);
2023-06-01 10:43:17 +02:00
return (
comment.state === "succeeded" ? null : (
2023-06-07 22:08:09 +02:00
comment.state === "initializing" ? null : (
<span className="ttl">
<>
<br />
(
<span className={className}>
{stateString}
</span>
)
</>
</span>
)
2023-06-01 10:43:17 +02:00
)
)
};
export default StateLabel;