From e762584a66fcc41eb9037e7ed3eeed62c746a0cf Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 25 Jul 2023 20:38:01 +0100 Subject: [PATCH] adding missing feature table columns --- .../building-passport/FeatureTableColumns.tsx | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/app/components/building-passport/FeatureTableColumns.tsx diff --git a/src/app/components/building-passport/FeatureTableColumns.tsx b/src/app/components/building-passport/FeatureTableColumns.tsx new file mode 100644 index 0000000..eedd7f0 --- /dev/null +++ b/src/app/components/building-passport/FeatureTableColumns.tsx @@ -0,0 +1,50 @@ +"use client"; + +import { Feature, GeneralFeature, Rating } from "@/app/db/schema/property"; +import { Badge } from "@/app/shadcn_components/ui/badge"; +import { ColumnDef } from "@tanstack/react-table"; + +function RatingBadge({ rating }: { rating: Rating }) { + const colourMap = { + "Very good": "bg-green-500 hover:bg-green-600", + Good: "bg-green-300 hover:bg-green-400", + Poor: "bg-yellow-300 hover:bg-yellow-400", + "Very poor": "bg-red-500 hover:bg-red-600", + "N/A": "bg-gray-500 hover:bg-gray-600", + }; + const ratingConfig = colourMap[rating]; + return {rating}; +} + +export const retrofitColumns: ColumnDef[] = [ + { + accessorKey: "feature", + header: "Feature", + }, + { + accessorKey: "description", + header: "Description", + }, + { + accessorKey: "rating", + header: "Rating", + cell: ({ row }) => { + return ( +
+ +
+ ); + }, + }, +]; + +export const generalColumns: ColumnDef[] = [ + { + accessorKey: "feature", + header: "Feature", + }, + { + accessorKey: "description", + header: "Description", + }, +];