Feed works with random testposts

This commit is contained in:
MisbehavedNinjaRadiator 2025-06-18 15:48:21 +02:00
parent 5061e4445f
commit 44e17e6287
5 changed files with 141 additions and 44 deletions

View file

@ -0,0 +1,30 @@
import React, { useMemo } from "react";
import "./testPost.css";
interface TestPostProps {
postId: number;
}
const getRandomColor = () => {
const letters = "0123456789ABCDEF";
let color = "#";
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
};
const TestPost: React.FC<TestPostProps> = ({ postId }) => {
const bgColor = useMemo(() => getRandomColor(), []);
return (
<div
className="testPostCard"
style={{ backgroundColor: bgColor }}
>
<span className="testPostNumber">{postId}</span>
</div>
);
};
export default TestPost;