articles
This commit is contained in:
50
src/views/home/articles/ArticleItem.tsx
Normal file
50
src/views/home/articles/ArticleItem.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Logo } from "../../../assets/logos";
|
||||
import { Account, Clipboard, Cup, Home, Openbook, Users } from "../../../assets/icons/menu";
|
||||
// import MenuItem from "./MenuItem";
|
||||
import { cn } from "../../../lib/cn";
|
||||
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`;
|
||||
}
|
||||
|
||||
export function formatBytesToMB(bytes: number): string {
|
||||
const megabytes = Math.floor(bytes / (1024 * 1024));
|
||||
return `${megabytes} МБ`;
|
||||
}
|
||||
|
||||
const ArticleItem: React.FC<ArticleItemProps> = ({
|
||||
id, authorId, name, tags, createdAt, updatedAt
|
||||
}) => {
|
||||
console.log(id);
|
||||
return (
|
||||
<div className={cn("h-[44px] w-full relative rounded-[10px] text-liquid-white",
|
||||
// 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",
|
||||
)}>
|
||||
<div className="text-[18px] font-bold">
|
||||
#{id}
|
||||
</div>
|
||||
<div className="text-[18px] font-bold">
|
||||
{name}
|
||||
</div>
|
||||
<div className="text-[12px] text-right">
|
||||
{/* стандартный ввод/вывод {formatMilliseconds(timeLimit)}, {formatBytesToMB(memoryLimit)} */}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ArticleItem;
|
||||
Reference in New Issue
Block a user