add mockup table

This commit is contained in:
Kentai Radiquum 2025-05-05 23:44:10 +05:00
parent 9d9bfa8aa8
commit d2da453808
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
3 changed files with 447 additions and 11 deletions

View file

@ -0,0 +1,414 @@
import {
Checkbox,
Table,
TableBody,
TableCell,
TableHead,
TableHeadCell,
TableRow,
} from "flowbite-react";
export const ModTable = () => {
return (
<div className="overflow-x-auto">
<Table hoverable>
<TableHead>
<TableRow>
<TableHeadCell className="p-4">
<Checkbox />
</TableHeadCell>
<TableHeadCell>Product name</TableHeadCell>
<TableHeadCell>Color</TableHeadCell>
<TableHeadCell>Category</TableHeadCell>
<TableHeadCell>Price</TableHeadCell>
<TableHeadCell>
<span className="sr-only">Edit</span>
</TableHeadCell>
</TableRow>
</TableHead>
<TableBody className="divide-y">
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Apple MacBook Pro 17"
</TableCell>
<TableCell>Sliver</TableCell>
<TableCell>Laptop</TableCell>
<TableCell>$2999</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Microsoft Surface Pro
</TableCell>
<TableCell>White</TableCell>
<TableCell>Laptop PC</TableCell>
<TableCell>$1999</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
<TableRow className="bg-white dark:border-gray-700 dark:bg-gray-800">
<TableCell className="p-4">
<Checkbox />
</TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Magic Mouse 2
</TableCell>
<TableCell>Black</TableCell>
<TableCell>Accessories</TableCell>
<TableCell>$99</TableCell>
<TableCell>
<a
href="#"
className="font-medium text-cyan-600 hover:underline dark:text-cyan-500"
>
Edit
</a>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
);
};

View file

@ -1,6 +1,6 @@
"use client"; "use client";
import { PACKS_ENDPOINT } from "@/api/ENDPOINTS"; import { PACK_ENDPOINT, PACKS_ENDPOINT } from "@/api/ENDPOINTS";
import { Pack } from "@/types/pack"; import { Pack } from "@/types/pack";
import { import {
Sidebar, Sidebar,
@ -31,11 +31,29 @@ export const Menu = () => {
{packsData && {packsData &&
packsData.map((pack) => { packsData.map((pack) => {
return ( return (
<SidebarItem href={`/pack/?id=${pack._id}`} key={pack._id}> <SidebarItem
<p className="line-clamp-1">{pack.title}</p> href={`/pack/?id=${pack._id}`}
<p className="text-sm text-gray-400 line-clamp-1"> key={pack._id}
by {pack.author} theme={{
</p> content: {
base: "p-0!",
},
}}
>
<div className="flex gap-2 items-center">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
alt=""
src={PACK_ENDPOINT("getPackImage", pack._id)}
className="w-10 h-10 rounded-md"
/>
<div>
<p className="line-clamp-1">{pack.title}</p>
<p className="text-sm text-gray-400 line-clamp-1">
by {pack.author}
</p>
</div>
</div>
</SidebarItem> </SidebarItem>
); );
})} })}

View file

@ -8,6 +8,7 @@ import { useRouter } from "next/navigation";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { HiDownload, HiTrash } from "react-icons/hi"; import { HiDownload, HiTrash } from "react-icons/hi";
import { ModTable } from "../components/ModTable";
export default function PackPage() { export default function PackPage() {
const [packData, setPackData] = useState<Pack | null>(null); const [packData, setPackData] = useState<Pack | null>(null);
@ -59,10 +60,10 @@ export default function PackPage() {
if (window.confirm(`Delete pack ${packData.title}?`)) { if (window.confirm(`Delete pack ${packData.title}?`)) {
fetch(`${PACKS_ENDPOINT("deletePack", packData._id)}`); fetch(`${PACKS_ENDPOINT("deletePack", packData._id)}`);
const ur = new URL(window.location.href) const ur = new URL(window.location.href);
ur.searchParams.delete("id") ur.searchParams.delete("id");
ur.pathname = "/" ur.pathname = "/";
window.location.href = ur.href window.location.href = ur.href;
} }
} }
@ -75,7 +76,7 @@ export default function PackPage() {
)} )}
{packData && ( {packData && (
<div> <div>
<Card className="sticky top-0 left-0 right-0"> <Card className="sticky top-0 left-0 right-0 z-10">
<div className="flex gap-4 items-center justify-between"> <div className="flex gap-4 items-center justify-between">
<div> <div>
<p className="text-xl font-semibold">{packData.version}</p> <p className="text-xl font-semibold">{packData.version}</p>
@ -112,6 +113,9 @@ export default function PackPage() {
</div> </div>
</div> </div>
</Card> </Card>
<div className="mt-4">
<ModTable />
</div>
</div> </div>
)} )}
</div> </div>