diff --git a/package.json b/package.json index 5663868..13ec4bf 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@radix-ui/react-tooltip": "^1.2.4", "@stripe/react-stripe-js": "^2.0.0", "@stripe/stripe-js": "^2.0.0", + "@tailwindcss/line-clamp": "^0.4.4", "axios": "^1.8.4", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/src/components/StatCard.jsx b/src/components/StatCard.jsx index e6a0f8b..5afc9f2 100644 --- a/src/components/StatCard.jsx +++ b/src/components/StatCard.jsx @@ -7,30 +7,77 @@ export const StatCard = ({ icon: Icon, iconBgClass, dataTestId, -}) => ( - -
-
- -
+}) => { + const valueString = value == null ? "" : String(value); -
-

- {value} -

-
-
-

{ + if (digitCount <= 3) { + // 3.75rem for 3 or fewer digits + return "3.75rem"; + } else if (digitCount <= 6) { + // Scale down for more digits + return "clamp(2rem, 5cqi, 3rem)"; + } else if (digitCount <= 9) { + return "clamp(1.5rem, 4cqi, 2.5rem)"; + } else { + return "clamp(1.25rem, 3cqi, 2rem)"; + } + }; + + * */ + + const getValueFontSize = () => { + switch (true) { + case digitCount <= 3: + // 3.75rem for 3 or fewer digits + return "3.75rem"; + case digitCount <= 6: + // Scale down for more digits + return "clamp(2rem, 5cqi, 3rem)"; + case digitCount <= 9: + return "clamp(1.5rem, 4cqi, 2.5rem)"; + default: + return "clamp(1.25rem, 3cqi, 2rem)"; + } + }; + const valueFontSize = getValueFontSize(); + + return ( + - {title} -

-
-); +
+
+

+ {value} +

+
+ +
+ +
+
+

+ {title} +

+ + ); +}; diff --git a/src/pages/admin/AdminDashboard.js b/src/pages/admin/AdminDashboard.js index fef95b2..8c0a4c2 100644 --- a/src/pages/admin/AdminDashboard.js +++ b/src/pages/admin/AdminDashboard.js @@ -60,7 +60,7 @@ const AdminDashboard = () => { return ( <> -
+

Admin Dashboard @@ -69,9 +69,9 @@ const AdminDashboard = () => { Manage users, events, and membership applications.

- +