From 8729a285d209f5f0f16d73e9f291013302f971e9 Mon Sep 17 00:00:00 2001 From: "moxey.eth" Date: Tue, 3 Oct 2023 14:11:03 +1100 Subject: [PATCH] feat: Button.Symbol labels --- src/components/Container.tsx | 1 + src/components/Header.tsx | 2 + src/design-system/_playground/index.tsx | 151 ++++++++++++++---- src/design-system/components/ButtonSymbol.tsx | 36 +++-- src/screens/account-details.tsx | 2 + src/screens/index.tsx | 3 + src/screens/networks.tsx | 3 + src/screens/session.tsx | 1 + 8 files changed, 158 insertions(+), 41 deletions(-) diff --git a/src/components/Container.tsx b/src/components/Container.tsx index 35fe885..2c19d1a 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -62,6 +62,7 @@ export function Container({ )} {dismissable && ( navigate(-1)} symbol="xmark" diff --git a/src/components/Header.tsx b/src/components/Header.tsx index b2eab7d..8b5ecd7 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -275,6 +275,7 @@ function Network() { { e.preventDefault() navigate(`/networks/${encodeURIComponent(network.rpcUrl)}`, { @@ -443,6 +444,7 @@ function MineButton() { style={{ marginTop: '8px' }} > { e.preventDefault() diff --git a/src/design-system/_playground/index.tsx b/src/design-system/_playground/index.tsx index 4232664..2005bce 100644 --- a/src/design-system/_playground/index.tsx +++ b/src/design-system/_playground/index.tsx @@ -493,12 +493,32 @@ function DesignSystem() { Solid - - - - - - + + + + + + @@ -506,11 +526,31 @@ function DesignSystem() { Stroked - - - - - + + + + + @@ -518,9 +558,21 @@ function DesignSystem() { Tint - - - + + + @@ -528,10 +580,26 @@ function DesignSystem() { Ghost - - - - + + + + @@ -539,90 +607,105 @@ function DesignSystem() { Height - + - + - + - + - + - + - + - + - + & { + label: string symbol: SymbolName symbolProps?: Partial } @@ -66,22 +68,28 @@ export const symbolStylesForVariant = { } satisfies Record export const ButtonSymbol = forwardRef( - ({ symbol, symbolProps, width, ...rootProps }: ButtonSymbolProps, ref) => { + ( + { label, symbol, symbolProps, width, ...rootProps }: ButtonSymbolProps, + ref, + ) => { const { height = '36px', variant = 'solid invert' } = rootProps return ( - - - + + + + + ) }, ) diff --git a/src/screens/account-details.tsx b/src/screens/account-details.tsx index 4560ad7..6eb55b5 100644 --- a/src/screens/account-details.tsx +++ b/src/screens/account-details.tsx @@ -46,6 +46,7 @@ export default function AccountDetails() { navigate(-1)} symbol="chevron.left" height="24px" @@ -253,6 +254,7 @@ function TokenRow({ {account.impersonate && ( setAccount({ account, setActive: true })} symbol="arrow.left.arrow.right" @@ -218,6 +220,7 @@ function AccountRow({ account }: { account: Account }) { {}} diff --git a/src/screens/networks.tsx b/src/screens/networks.tsx index 732d66b..b81152b 100644 --- a/src/screens/networks.tsx +++ b/src/screens/networks.tsx @@ -187,6 +187,7 @@ function NetworkRow({ {showRemove && ( removeNetwork(network.rpcUrl)} height="20px" symbol="trash" @@ -194,6 +195,7 @@ function NetworkRow({ /> )} navigate(`/networks/${encodeURIComponent(network.rpcUrl)}`) } @@ -202,6 +204,7 @@ function NetworkRow({ variant="stroked fill" /> switchNetwork(network.rpcUrl)} height="20px" diff --git a/src/screens/session.tsx b/src/screens/session.tsx index 9b41b68..2db6218 100644 --- a/src/screens/session.tsx +++ b/src/screens/session.tsx @@ -91,6 +91,7 @@ export default function Session() { {