This commit is contained in:
Виталий Лавшонок
2025-10-29 10:37:37 +03:00
parent 34a404f147
commit 5ef7933446
2 changed files with 126 additions and 57 deletions

View File

@@ -6,43 +6,50 @@ import { IconError, IconSuccess } from "../../../assets/icons/problems";
export interface ArticleItemProps {
id: number;
authorId: number;
name: string;
tags: string[];
createdAt: string;
updatedAt: string;
}
export function formatMilliseconds(ms: number): string {
const rounded = Math.round(ms) / 1000;
const formatted = rounded.toString().replace(/\.?0+$/, '');
return `${formatted} c`;
const rounded = Math.round(ms) / 1000;
const formatted = rounded.toString().replace(/\.?0+$/, '');
return `${formatted} c`;
}
export function formatBytesToMB(bytes: number): string {
const megabytes = Math.floor(bytes / (1024 * 1024));
return `${megabytes} МБ`;
const megabytes = Math.floor(bytes / (1024 * 1024));
return `${megabytes} МБ`;
}
const ArticleItem: React.FC<ArticleItemProps> = ({
id, authorId, name, tags, createdAt, updatedAt
id, name, tags
}) => {
console.log(id);
return (
<div className={cn("h-[44px] w-full relative rounded-[10px] text-liquid-white",
<div className={cn("w-full relative rounded-[10px] text-liquid-white mb-[20px]",
// type == "first" ? "bg-liquid-lighter" : "bg-liquid-background",
"grid grid-cols-[1fr,1fr,1fr] grid-flow-col gap-[20px] px-[20px] box-border items-center",
"gap-[20px] px-[20px] py-[10px] box-border ",
"border-b-[1px] border-b-liquid-lighter",
)}>
<div className="text-[18px] font-bold">
#{id}
<div className="h-[23px] flex ">
<div className="text-[18px] font-bold w-[60px] mr-[20px] flex items-center">
#{id}
</div>
<div className="text-[18px] font-bold flex items-center bg-red-400r">
{name}
</div>
</div>
<div className="text-[18px] font-bold">
{name}
<div className="text-[14px] flex text-liquid-light gap-[10px] mt-[10px]">
{tags.map((v, i) =>
<div key={i} className={cn(
"rounded-full px-[16px] py-[8px] bg-liquid-lighter",
v == "Sertificated" && "text-liquid-green")}>
{v}
</div>
)}
</div>
<div className="text-[12px] text-right">
{/* стандартный ввод/вывод {formatMilliseconds(timeLimit)}, {formatBytesToMB(memoryLimit)} */}
</div>
</div>
);
};