[dyad] Replaced the status badge with a dot indicator - wrote 1 file(s)
This commit is contained in:
parent
b3c4d3b2b4
commit
2e5e2f5239
1 changed files with 13 additions and 4 deletions
|
|
@ -13,7 +13,6 @@ import {
|
|||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
|
||||
export type StockItem = {
|
||||
id: string
|
||||
|
|
@ -99,10 +98,20 @@ export const columns: ColumnDef<StockItem>[] = [
|
|||
accessorKey: "status",
|
||||
header: "Status",
|
||||
cell: ({ row }) => {
|
||||
const status = row.getValue("status") as string
|
||||
const variant = status === "In Stock" ? "default" : status === "Low Stock" ? "secondary" : "destructive"
|
||||
const status = row.getValue("status") as "In Stock" | "Low Stock" | "Out of Stock"
|
||||
|
||||
return <Badge variant={variant}>{status}</Badge>
|
||||
const statusColor = {
|
||||
"In Stock": "bg-green-500",
|
||||
"Low Stock": "bg-yellow-500",
|
||||
"Out of Stock": "bg-red-500",
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<span className={`h-2.5 w-2.5 rounded-full mr-2 ${statusColor[status]}`} />
|
||||
<span>{status}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue