From d3f3dba8a523672e38bb214e1a8f566be11e4fce Mon Sep 17 00:00:00 2001 From: zzhhaa Date: Thu, 23 Jan 2025 12:27:18 +0000 Subject: [PATCH 1/4] feat: rename colour {tenure}-detail-color --- app/components/graphs/CostOverTimeWrapper.tsx | 6 +++--- app/globals.css | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/components/graphs/CostOverTimeWrapper.tsx b/app/components/graphs/CostOverTimeWrapper.tsx index 877f58f..8b5e6e9 100644 --- a/app/components/graphs/CostOverTimeWrapper.tsx +++ b/app/components/graphs/CostOverTimeWrapper.tsx @@ -11,17 +11,17 @@ const TENURE_COLORS = { marketPurchase: { land: "rgb(var(--freehold-land-color-rgb))", house: "rgb(var(--freehold-house-color-rgb))", - maintenance: "rgb(var(--freehold-maintenance-color-rgb))", + maintenance: "rgb(var(--freehold-detail-color-rgb))", }, fairholdLandPurchase: { land: "rgb(var(--fairhold-land-color-rgb))", house: "rgb(var(--fairhold-house-color-rgb))", - maintenance: "rgb(var(--fairhold-maintenance-color-rgb))", + maintenance: "rgb(var(--fairhold-detail-color-rgb))", }, fairholdLandRent: { land: "rgb(var(--fairhold-land-color-rgb))", house: "rgb(var(--fairhold-house-color-rgb))", - maintenance: "rgb(var(--fairhold-maintenance-color-rgb))", + maintenance: "rgb(var(--fairhold-detail-color-rgb))", }, marketRent: { land: "rgb(var(--private-rent-land-color-rgb))", diff --git a/app/globals.css b/app/globals.css index 1e00982..acba507 100644 --- a/app/globals.css +++ b/app/globals.css @@ -15,14 +15,16 @@ --freehold-land-color-rgb: 66 75 179; --freehold-house-color-rgb: 131 164 255; - --freehold-maintenance-color-rgb: 190 201 232; + --freehold-detail-color-rgb: 190 201 232; --fairhold-land-color-rgb: 74 179 91; --fairhold-house-color-rgb: 159 211 166; - --fairhold-maintenance-color-rgb: 207 227 209; + --fairhold-detail-color-rgb: 207 227 209; --private-rent-land-color-rgb: 45 155 240; --private-rent-house-color-rgb: 119 188 242; + --private-rent-detail-color-rgb: 203 225 242; --social-rent-land-color-rgb: 255 97 118; --social-rent-house-color-rgb: 242 160 171; + --social-rent-detail-color-rgb: 242 196 202; } @layer utilities { From 6228459f402e57cce2b3b12685ff6933cb345973 Mon Sep 17 00:00:00 2001 From: zzhhaa Date: Thu, 23 Jan 2025 12:29:02 +0000 Subject: [PATCH 2/4] feat: update TenureSelector colours and shape --- .../Dashboard/Cards/ResaleValue.tsx | 1 + app/components/ui/TenureSelector.tsx | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/components/Dashboard/Cards/ResaleValue.tsx b/app/components/Dashboard/Cards/ResaleValue.tsx index 085dc99..92afb28 100644 --- a/app/components/Dashboard/Cards/ResaleValue.tsx +++ b/app/components/Dashboard/Cards/ResaleValue.tsx @@ -26,6 +26,7 @@ export const ResaleValue: React.FC = ({ data }) => { setSelectedTenure(tenure)} > {`Fairhold ${tenure === 'landPurchase' ? 'Land Purchase' : 'Land Rent'}`} diff --git a/app/components/ui/TenureSelector.tsx b/app/components/ui/TenureSelector.tsx index eaab5e9..1c7b9a0 100644 --- a/app/components/ui/TenureSelector.tsx +++ b/app/components/ui/TenureSelector.tsx @@ -6,6 +6,7 @@ interface TenureSelectorProps { onClick?: () => void; className?: string; children: React.ReactNode; + tenureType: 'marketPurchase' | 'marketRent' | 'fairhold' | 'socialRent'; } const TenureSelector: React.FC = ({ @@ -13,16 +14,32 @@ const TenureSelector: React.FC = ({ onClick, className, children, + tenureType }) => { + const getColors = () => { + if (!isSelected) return "bg-gray-100 text-gray-700 hover:bg-gray-200"; + + switch (tenureType) { + case 'marketPurchase': + return "bg-[rgb(var(--freehold-detail-color-rgb))] text-[rgb(var(--freehold-land-color-rgb))]"; + case 'marketRent': + return "bg-[rgb(var(--private-rent-detail-color-rgb))] text-[rgb(var(--private-rent-land-color-rgb))]"; + case 'fairhold': + return "bg-[rgb(var(--fairhold-detail-color-rgb))] text-[rgb(var(--fairhold-land-color-rgb))]"; + case 'socialRent': + return "bg-[rgb(var(--social-rent-detail-color-rgb))] text-[rgb(var(--social-rent-land-color-rgb))]"; + default: + return "bg-gray-100 text-gray-700"; + } + }; + return (