diff --git a/app/components/ui/adminProductTable/AdminProductListTable.tsx b/app/components/ui/adminProductTable/AdminProductListTable.tsx new file mode 100644 index 00000000..d6407ac1 --- /dev/null +++ b/app/components/ui/adminProductTable/AdminProductListTable.tsx @@ -0,0 +1,258 @@ +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "app/components/ui/pagination"; +import React, { useState } from "react"; + +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "~/components/ui/adminProductTable/table"; +import { Button } from "../button"; +import { Badge } from "./badge"; + +interface Product { + name: string; + price: string; + totalSold: string; + status: string; + createdAt: string; + action: JSX.Element; +} + +const products: Product[] = [ + { + name: "Hypernova Headphones", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "Hypernova Headphones", + price: "$129.99", + totalSold: "25", + status: "Active", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "AeroGlow Desk Lamp", + price: "$129.99", + totalSold: "25", + status: "Active", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, + { + name: "TechTonic Energy Drink", + price: "$129.99", + totalSold: "25", + status: "Draft", + createdAt: "2024-07-16 10:36AM", + action: option, + }, +]; + +const AdminProductListTable: React.FC = () => { + const [currentPage, setCurrentPage] = useState(1); + const itemsPerPage = 4; + + const totalPages = Math.ceil(products.length / itemsPerPage); + + const handlePageChange = (page: number) => { + setCurrentPage(page); + }; + + const paginatedProducts = products.slice( + (currentPage - 1) * itemsPerPage, + currentPage * itemsPerPage, + ); + + return ( +
+
+
+
+

+ Products +

+

+ Manage your products and view their sales performance. +

+
+ +
+ + +
+
+ + + + + Name + + + Price + + + Total Sold + + + Status + + + Created At + + + Action + + + + + {paginatedProducts.map((product, index) => ( + + + +
+

{product.name}

+ + + {product.price} + + {product.totalSold} + + + {product.status} + + + {product.createdAt} + {product.action} + + ))} + +
+ + {currentPage > 1 && ( + handlePageChange(currentPage - 1)} + size="default" + /> + )} + + {Array.from({ length: totalPages }, (_, index) => ( + + handlePageChange(index + 1)} + size="default" // Adding default size + > + {index + 1} + + + ))} + + {currentPage < totalPages && ( + handlePageChange(currentPage + 1)} + size="default" + /> + )} + +
+
+ ); +}; + +export default AdminProductListTable; diff --git a/app/components/ui/adminProductTable/badge.tsx b/app/components/ui/adminProductTable/badge.tsx new file mode 100644 index 00000000..9dda3bc6 --- /dev/null +++ b/app/components/ui/adminProductTable/badge.tsx @@ -0,0 +1,38 @@ +import { cn } from "app/lib/utils/cn"; +import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + }, +); + +export interface BadgeProperties + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...properties }: BadgeProperties) { + return ( +
+ ); +} + +export { Badge, badgeVariants }; diff --git a/app/components/ui/adminProductTable/table.tsx b/app/components/ui/adminProductTable/table.tsx new file mode 100644 index 00000000..0182363e --- /dev/null +++ b/app/components/ui/adminProductTable/table.tsx @@ -0,0 +1,120 @@ +import { cn } from "app/lib/utils/cn"; +import * as React from "react"; + +const Table = React.forwardRef< + HTMLTableElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( +
+ + +)); +Table.displayName = "Table"; + +const TableHeader = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( + +)); +TableHeader.displayName = "TableHeader"; + +const TableBody = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( + +)); +TableBody.displayName = "TableBody"; + +const TableFooter = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( + tr]:last:border-b-0", + className, + )} + {...properties} + /> +)); +TableFooter.displayName = "TableFooter"; + +const TableRow = React.forwardRef< + HTMLTableRowElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( + +)); +TableRow.displayName = "TableRow"; + +const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes +>(({ className, ...properties }, reference) => ( +
+)); +TableHead.displayName = "TableHead"; + +const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes +>(({ className, ...properties }, reference) => ( + +)); +TableCell.displayName = "TableCell"; + +const TableCaption = React.forwardRef< + HTMLTableCaptionElement, + React.HTMLAttributes +>(({ className, ...properties }, reference) => ( +
+)); +TableCaption.displayName = "TableCaption"; + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +}; diff --git a/app/components/ui/revenueCard/RevenueCard.tsx b/app/components/ui/revenueCard/RevenueCard.tsx index 81ac677e..e9a7fc5e 100644 --- a/app/components/ui/revenueCard/RevenueCard.tsx +++ b/app/components/ui/revenueCard/RevenueCard.tsx @@ -10,7 +10,7 @@ const RevenueCard: React.FC = ({ revenue, change }) => {
-

+

Total Revenue

= ({ revenue, change }) => { />
-

+

${revenue}

diff --git a/app/components/ui/revenueCard/cardComponent.tsx b/app/components/ui/revenueCard/cardComponent.tsx index 86f3d128..a94e9d8f 100644 --- a/app/components/ui/revenueCard/cardComponent.tsx +++ b/app/components/ui/revenueCard/cardComponent.tsx @@ -1,6 +1,8 @@ +import { FC, HTMLAttributes } from "react"; + import { cn } from "~/lib/utils/cn"; -export const Card: React.FC> = ({ +export const Card: FC> = ({ className, ...properties }) => ( @@ -13,23 +15,22 @@ export const Card: React.FC> = ({ /> ); -export const CardContent: React.FC> = ({ +export const CardContent: FC> = ({ className, ...properties }) =>
; -export const CardHeader: React.FC> = ({ +export const CardHeader: FC> = ({ className, ...properties }) =>
; -export const CardTitle: React.FC> = ({ +export const CardTitle: FC> = ({ className, ...properties }) =>

; -export const CardDescription: React.FC< - React.HTMLAttributes -> = ({ className, ...properties }) => ( -

-); +export const CardDescription: FC> = ({ + className, + ...properties +}) =>

; diff --git a/app/routes/product-list.tsx b/app/routes/product-list.tsx index dd76ee8b..07fc80fa 100644 --- a/app/routes/product-list.tsx +++ b/app/routes/product-list.tsx @@ -1,11 +1,15 @@ +import AdminProductListTable from "~/components/ui/adminProductTable/AdminProductListTable"; import RevenueCard from "~/components/ui/revenueCard/RevenueCard"; const App: React.FC = () => { return ( -

- - - +
+
+ + + +
+
); }; diff --git a/public/icons/Rectangle2.png b/public/icons/Rectangle2.png new file mode 100644 index 00000000..f9de8423 Binary files /dev/null and b/public/icons/Rectangle2.png differ diff --git a/public/icons/addicon2.svg b/public/icons/addicon2.svg new file mode 100644 index 00000000..31387d2f --- /dev/null +++ b/public/icons/addicon2.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/public/icons/filterIcon2.svg b/public/icons/filterIcon2.svg new file mode 100644 index 00000000..2be939d1 --- /dev/null +++ b/public/icons/filterIcon2.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/option-icon2.svg b/public/icons/option-icon2.svg new file mode 100644 index 00000000..faa75361 --- /dev/null +++ b/public/icons/option-icon2.svg @@ -0,0 +1,5 @@ + + + + +