From 036487dda4323d17c156919bef7e6647b24320b9 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Wed, 26 Apr 2023 15:10:29 -0500 Subject: [PATCH 1/2] fixups for amount editor --- src/components/AmountEditable.tsx | 58 ++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/src/components/AmountEditable.tsx b/src/components/AmountEditable.tsx index 8ee1701..58f28a2 100644 --- a/src/components/AmountEditable.tsx +++ b/src/components/AmountEditable.tsx @@ -1,20 +1,27 @@ -import { For, createMemo, createSignal } from 'solid-js'; +import { For, Show, createMemo, createSignal } from 'solid-js'; import { Button } from '~/components/layout'; import { useMegaStore } from '~/state/megaStore'; import { satsToUsd } from '~/utils/conversions'; import { Amount } from './Amount'; import { Dialog } from '@kobalte/core'; +import close from "~/assets/icons/close.svg"; const CHARACTERS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "0", "DEL"]; -function SingleDigitButton(props: { character: string, onClick: (c: string) => void }) { +const FIXED_AMOUNTS = [{ label: "10k", amount: "10000" }, { label: "100k", amount: "100000" }, { label: "1m", amount: "1000000" }] + +function SingleDigitButton(props: { character: string, onClick: (c: string) => void, fiat: boolean }) { return ( - + // Skip the "." if it's fiat + }> + + ); } @@ -124,9 +131,7 @@ export function AmountEditable(props: { initialAmountSats: string, setAmountSats } const DIALOG_POSITIONER = "fixed inset-0 safe-top safe-bottom z-50" - const DIALOG_CONTENT = "h-screen-safe p-4 bg-gray/50 backdrop-blur-md bg-black/80" - - + const DIALOG_CONTENT = "h-screen-safe flex flex-col justify-between p-4 backdrop-blur-md bg-neutral-800/70" return ( @@ -136,8 +141,13 @@ export function AmountEditable(props: { initialAmountSats: string, setAmountSats {/* */}
- + setIsOpen(false)}> {/* TODO: figure out how to submit on enter */} +
+ +
inputRef = el} autofocus @@ -148,24 +158,30 @@ export function AmountEditable(props: { initialAmountSats: string, setAmountSats onInput={(e) => handleHiddenInput(e)} />
-
-
-

+
+
+

{prettyPrint()} SATS

≈ {amountInUsd()} USD

-
- - {(character) => ( - +
+ + {(amount) => ( + )}
- {/* TODO: this feels wrong */} -
From bf8178cce53b9218b1a29e4639d8fb07af0d9ef3 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Wed, 26 Apr 2023 17:08:08 -0500 Subject: [PATCH 2/2] fix tailwind --- src/components/layout/Radio.tsx | 1 + tailwind.config.cjs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/components/layout/Radio.tsx b/src/components/layout/Radio.tsx index af44725..efa7eb8 100644 --- a/src/components/layout/Radio.tsx +++ b/src/components/layout/Radio.tsx @@ -6,6 +6,7 @@ type Choices = { value: string, label: string, caption: string }[] // TODO: how could would it be if we could just pass the estimated fees in here? export function StyledRadioGroup(props: { value: string, choices: Choices, onValueChange: (value: string) => void, small?: boolean, }) { return ( + // TODO: rewrite this with CVA, props are bad for tailwind props.onValueChange(e)} class={`grid w-full gap-${props.small ? "2" : "4"} grid-cols-${props.choices.length.toString()}`}> {choice => diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 9cd610e..7b03d9e 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -6,6 +6,12 @@ module.exports = { "./index.html", "./src/**/*.{js,ts,jsx,tsx}", ], + safelist: [ + 'grid-cols-1', + 'grid-cols-2', + 'gap-2', + 'gap-4' + ], variants: { extend: { borderWidth: ['responsive', 'last', 'hover', 'focus'],