diff --git a/packages/common/components/src/ui/table/index.tsx b/packages/common/components/src/ui/table/index.tsx index 8ef508e03..425fdba0c 100644 --- a/packages/common/components/src/ui/table/index.tsx +++ b/packages/common/components/src/ui/table/index.tsx @@ -4,18 +4,21 @@ import * as React from "react"; import { cn } from "../../lib/utils"; -const Table = React.forwardRef< - HTMLTableElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
- - -)); +interface TableProps extends React.HTMLAttributes { + variant?: "default" | "secondary" | "line"; +} + +const Table = React.forwardRef( + ({ className, variant, ...props }, ref) => ( +
+
+ + ), +); Table.displayName = "Table"; const TableHeader = React.forwardRef< @@ -74,10 +77,7 @@ const TableHead = React.forwardRef< >(({ className, ...props }, ref) => (
)); @@ -89,7 +89,7 @@ const TableCell = React.forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/packages/common/components/src/ui/table/table.css b/packages/common/components/src/ui/table/table.css index 25caaaa41..24983d4a4 100644 --- a/packages/common/components/src/ui/table/table.css +++ b/packages/common/components/src/ui/table/table.css @@ -1,6 +1,22 @@ th { - @apply bg-[#c6ccd1] px-4 py-[1.2rem] text-[1.3rem] font-normal text-[#fff]; + @apply bg-[#5987bf] px-4 py-[1.2rem] text-[1.3rem] font-medium leading-[1.2] text-[#fff]; } td { - @apply border-b border-b-[#e0e6ea] px-4 py-[1.2rem] text-[1.3rem] font-normal text-[#666]; + @apply border-b border-b-[#e0e6ea] bg-[#fff] px-2 py-[1.2rem] text-[1.3rem] font-normal leading-[1.2] text-[#666]; +} + +.secondary th { + @apply border border-[#e0e6ea] bg-[#eaf3fb] text-[#647784]; +} + +.secondary td { + @apply border border-[#e0e6ea]; +} + +.line th { + @apply border-0 border-b-2 border-t border-b-[#d4e0ea] border-t-[#d4e0ea] bg-[#fff] text-[#555]; +} + +.line td { + @apply border-b border-b-[#e0e6ea]; } diff --git a/packages/common/components/src/ui/table/table.stories.tsx b/packages/common/components/src/ui/table/table.stories.tsx index b39dec873..571c5c4fd 100644 --- a/packages/common/components/src/ui/table/table.stories.tsx +++ b/packages/common/components/src/ui/table/table.stories.tsx @@ -17,41 +17,41 @@ const meta: Meta = { export default meta; type Story = StoryObj; +const invoices = [ + { + invoice: "INV001", + paymentStatus: "Paid", + totalAmount: "$250.00", + paymentMethod: "Credit Card", + }, + { + invoice: "INV002", + paymentStatus: "Pending", + totalAmount: "$150.00", + paymentMethod: "PayPal", + }, + { + invoice: "INV003", + paymentStatus: "Unpaid", + totalAmount: "$350.00", + paymentMethod: "Bank Transfer", + }, + { + invoice: "INV004", + paymentStatus: "Paid", + totalAmount: "$450.00", + paymentMethod: "Credit Card", + }, + { + invoice: "INV005", + paymentStatus: "Paid", + totalAmount: "$550.00", + paymentMethod: "PayPal", + }, +]; + export const Default: Story = { render: () => { - const invoices = [ - { - invoice: "INV001", - paymentStatus: "Paid", - totalAmount: "$250.00", - paymentMethod: "Credit Card", - }, - { - invoice: "INV002", - paymentStatus: "Pending", - totalAmount: "$150.00", - paymentMethod: "PayPal", - }, - { - invoice: "INV003", - paymentStatus: "Unpaid", - totalAmount: "$350.00", - paymentMethod: "Bank Transfer", - }, - { - invoice: "INV004", - paymentStatus: "Paid", - totalAmount: "$450.00", - paymentMethod: "Credit Card", - }, - { - invoice: "INV005", - paymentStatus: "Paid", - totalAmount: "$550.00", - paymentMethod: "PayPal", - }, - ]; - return ( @@ -76,3 +76,57 @@ export const Default: Story = { ); }, }; + +export const Secondary: Story = { + render: () => { + return ( +
+ + + Invoice + Status + Amount + Payment Method + + + + {invoices.map((invoice) => ( + + {invoice.invoice} + {invoice.paymentStatus} + {invoice.totalAmount} + {invoice.paymentMethod} + + ))} + +
+ ); + }, +}; + +export const Line: Story = { + render: () => { + return ( + + + + Invoice + Status + Amount + Payment Method + + + + {invoices.map((invoice) => ( + + {invoice.invoice} + {invoice.paymentStatus} + {invoice.totalAmount} + {invoice.paymentMethod} + + ))} + +
+ ); + }, +};