diff --git a/src/views/home/articles/ArticleItem.tsx b/src/views/home/articles/ArticleItem.tsx index 838daf2..680b031 100644 --- a/src/views/home/articles/ArticleItem.tsx +++ b/src/views/home/articles/ArticleItem.tsx @@ -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 = ({ - id, authorId, name, tags, createdAt, updatedAt + id, name, tags }) => { console.log(id); return ( -
-
- #{id} +
+ +
+ #{id} +
+
+ {name} +
-
- {name} +
+ {tags.map((v, i) => +
+ {v} +
+ )}
-
- {/* стандартный ввод/вывод {formatMilliseconds(timeLimit)}, {formatBytesToMB(memoryLimit)} */} -
- +
); }; diff --git a/src/views/home/articles/Articles.tsx b/src/views/home/articles/Articles.tsx index 618e678..b37a8a5 100644 --- a/src/views/home/articles/Articles.tsx +++ b/src/views/home/articles/Articles.tsx @@ -1,9 +1,5 @@ -import { Logo } from "../../../assets/logos"; -import { Account, Clipboard, Cup, Home, Openbook, Users } from "../../../assets/icons/menu"; -// import MenuItem from "./MenuItem"; -import { useAppSelector } from "../../../redux/hooks"; -// import ProblemItem from "./ProblemItem"; import { SecondaryButton } from "../../../components/button/SecondaryButton"; +import ArticleItem, { ArticleItemProps } from "./ArticleItem"; export interface Problem { @@ -21,50 +17,116 @@ export interface Problem { const Articles = () => { - const problems: Problem[] = [ + const articles: ArticleItemProps[] = [ { "id": 1, - "authorId": 1, "name": "Todo List App", - "difficulty": "Easy", - "tags": ["react", "state", "list"], - "timeLimit": 1000, - "memoryLimit": 268435456, - "createdAt": "2025-10-28T13:23:13.000Z", - "updatedAt": "2025-10-28T13:23:13.000Z" + "tags": ["Sertificated", "state", "list"], }, { "id": 2, - "authorId": 1, "name": "Search Filter Component", - "difficulty": "Medium", "tags": ["filter", "props", "hooks"], - "timeLimit": 1000, - "memoryLimit": 268435456, - "createdAt": "2025-10-28T13:23:14.000Z", - "updatedAt": "2025-10-28T13:23:14.000Z" }, { "id": 3, - "authorId": 1, "name": "User Card List", - "difficulty": "Easy", "tags": ["components", "props", "array"], - "timeLimit": 1000, - "memoryLimit": 268435456, - "createdAt": "2025-10-28T13:23:15.000Z", - "updatedAt": "2025-10-28T13:23:15.000Z" }, { "id": 4, - "authorId": 1, "name": "Theme Switcher", - "difficulty": "Medium", - "tags": ["context", "theme", "hooks"], - "timeLimit": 1000, - "memoryLimit": 268435456, - "createdAt": "2025-10-28T13:23:16.000Z", - "updatedAt": "2025-10-28T13:23:16.000Z" + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], + }, + { + "id": 2, + "name": "Search Filter Component", + "tags": ["filter", "props", "hooks"], + }, + { + "id": 3, + "name": "User Card List", + "tags": ["components", "props", "array"], + }, + { + "id": 4, + "name": "Theme Switcher", + "tags": ["Sertificated", "theme", "hooks"], } ]; @@ -77,8 +139,8 @@ const Articles = () => {
База статей
- {}} + { }} text="Создать статью" className="absolute right-0" /> @@ -90,12 +152,12 @@ const Articles = () => {
- {/* {problems.map((v, i) => ( - - ))} */} + {articles.map((v, i) => ( + + ))}
- +
pages