From 7de0680b3273342cb92f3219be97d439852ced6e Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 27 Oct 2024 16:36:21 +0100 Subject: [PATCH] refactor(home): walletCard next-ui (#787) * refactor(home): walletCard next-ui * chore: use as const for type-prop --- src/components/Headline.tsx | 18 +++++++--- src/pages/Home/WalletCard.tsx | 64 ++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/src/components/Headline.tsx b/src/components/Headline.tsx index 23a4a107..e61da687 100644 --- a/src/components/Headline.tsx +++ b/src/components/Headline.tsx @@ -5,8 +5,17 @@ export interface HeadlineProps { as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; children: ReactNode; size?: FontSizes; + align?: Alignment; } +export const alignment = { + left: "text-left", + center: "text-center", + right: "text-right", +} as const; + +export type Alignment = keyof typeof alignment; + export const fontSizes = { "5xl": "text-5xl", "4xl": "text-4xl", @@ -15,21 +24,22 @@ export const fontSizes = { xl: "text-xl", base: "text-base", sm: "text-sm", -}; +} as const; export type FontSizes = keyof typeof fontSizes; export const Headline = ({ - as = "h1", + as: Component = "h1", size = "3xl", + align = "center", children, }: HeadlineProps) => { - const Component = as; return ( {children} diff --git a/src/pages/Home/WalletCard.tsx b/src/pages/Home/WalletCard.tsx index ec11fe5f..efd28ae6 100644 --- a/src/pages/Home/WalletCard.tsx +++ b/src/pages/Home/WalletCard.tsx @@ -1,3 +1,5 @@ +import { Button } from "@/components/Button"; +import { Headline } from "@/components/Headline"; import { AppContext, Unit } from "@/context/app-context"; import { SSEContext } from "@/context/sse-context"; import { @@ -79,18 +81,20 @@ export const WalletCard: FC = ({
-
{t("wallet.balance")}
+ + {t("wallet.balance")} +

{convertToString(unit, totalBalance)} {unit}

-
+ {t("wallet.on_chain")} -
+

{convertToString(unit, convertedOnchainBalance)} {unit}  @@ -105,12 +109,12 @@ export const WalletCard: FC = ({

-
+ {t("home.lightning")} -
+

{convertToString(unit, convertedLnBalance)} {unit}

@@ -118,37 +122,43 @@ export const WalletCard: FC = ({
-
- - -
-
- - + {t("home.list_open_channels")} +