Skip to content

Commit

Permalink
Migration to daisyUI
Browse files Browse the repository at this point in the history
  • Loading branch information
slhmy authored Jan 31, 2024
1 parent 44827cc commit 12b1403
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 180 deletions.
24 changes: 0 additions & 24 deletions src/components/Copyright.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions src/components/Footer.tsx

This file was deleted.

59 changes: 29 additions & 30 deletions src/components/JudgeVerdictTable.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
import {
Table,
TableBody,
TableColumn,
TableHeader,
TableRow,
TableCell,
Chip,
} from "@nextui-org/react";
import { JudgeModel } from "../typings/judge";

const columns = [
Expand All @@ -17,31 +8,39 @@ const columns = [

export interface JudgeVerdictTableProps {
data: JudgeModel.JudgeVerdict[];
className?: string;
}

const JudgeVerdictTable: React.FC<JudgeVerdictTableProps> = (props) => {
return (
<Table>
<TableHeader columns={columns}>
{(column) => <TableColumn key={column.uid}>{column.name}</TableColumn>}
</TableHeader>
<TableBody items={props.data}>
{(item) => (
<TableRow key={item.id}>
<TableCell>
<Chip
color={item.verdict === "Accepted" ? "success" : "danger"}
variant="bordered"
>
{item.verdict}
</Chip>
</TableCell>
<TableCell>{item.time_usage}</TableCell>
<TableCell>{item.memory_usage}</TableCell>
</TableRow>
)}
</TableBody>
</Table>
<div className={props.className}>
<table className="table" aria-label="Judge Verdict Table">
<thead>
<tr>
{columns.map((column) => (
<th key={column.uid}>{column.name}</th>
))}
</tr>
</thead>
<tbody>
{props.data.map((judgeVerdict) => (
<tr>
<th>
<div
className={`badge badge-outline ${
judgeVerdict.verdict === "Accepted" ? "badge-success" : ""
}`}
>
{judgeVerdict.verdict}
</div>
</th>
<td>{judgeVerdict.time_usage}</td>
<td>{judgeVerdict.memory_usage}</td>
</tr>
))}
</tbody>
</table>
</div>
);
};

Expand Down
3 changes: 1 addition & 2 deletions src/components/ProblemTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { TrashIcon, PencilSquareIcon } from "@heroicons/react/24/outline";
import { ProblemServiceModel } from "../typings/problem";
import React from "react";
import { useNavigate } from "react-router-dom";
import { joinClasses } from "../utils/common";

const columns = [
{ name: "SLUG", uid: "slug" },
Expand All @@ -23,7 +22,7 @@ const ProblemTable: React.FC<ProblemTableProps> = (props) => {

return (
<div className={props.className}>
<table className={joinClasses("table")} aria-label="Problem Table">
<table className="table" aria-label="Problem Table">
<thead>
<tr>
{columns.map((column) => {
Expand Down
Loading

0 comments on commit 12b1403

Please sign in to comment.