diff --git a/extension/src/components/Input.tsx b/extension/src/components/Input.tsx index c9cfc36a..5f5a6f1a 100644 --- a/extension/src/components/Input.tsx +++ b/extension/src/components/Input.tsx @@ -1,18 +1,31 @@ import { ReactNode, useId } from 'react' +type RenderProps = { + inputId: string + descriptionId: string +} + type InputProps = { label: string - children: (inputId: string) => ReactNode + description?: string + children: (props: RenderProps) => ReactNode } -export const Input = ({ children, label }: InputProps) => { - const id = useId() +export const Input = ({ children, label, description }: InputProps) => { + const inputId = useId() + const descriptionId = useId() return (
- + + + {children({ inputId, descriptionId })} - {children(id)} + {description && ( + + {description} + + )}
) } diff --git a/extension/src/components/TextInput.tsx b/extension/src/components/TextInput.tsx index 791009a4..92a6c8c8 100644 --- a/extension/src/components/TextInput.tsx +++ b/extension/src/components/TextInput.tsx @@ -6,15 +6,17 @@ type TextInputProps = Omit< 'id' | 'type' | 'className' > & { label: string + description?: string } -export const TextInput = ({ label, ...props }: TextInputProps) => ( - - {(id) => ( +export const TextInput = ({ label, description, ...props }: TextInputProps) => ( + + {({ inputId, descriptionId }) => ( )} diff --git a/extension/src/panel/app-routes/transactions/BaseTransaction.tsx b/extension/src/panel/app-routes/transactions/BaseTransaction.tsx deleted file mode 100644 index f2ae0d0f..00000000 --- a/extension/src/panel/app-routes/transactions/BaseTransaction.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { Box } from '@/components' -import { PropsWithChildren } from 'react' - -export const BaseTransaction = ({ - children, - value, -}: PropsWithChildren<{ value: string }>) => ( - -) diff --git a/extension/src/panel/app-routes/transactions/DecodedTransaction.tsx b/extension/src/panel/app-routes/transactions/DecodedTransaction.tsx index 335b4177..e39eec14 100644 --- a/extension/src/panel/app-routes/transactions/DecodedTransaction.tsx +++ b/extension/src/panel/app-routes/transactions/DecodedTransaction.tsx @@ -1,6 +1,5 @@ -import { Box } from '@/components' +import { Box, TextInput } from '@/components' import { FunctionFragment, Result } from 'ethers' -import { BaseTransaction } from './BaseTransaction' interface Props { functionFragment: FunctionFragment @@ -14,11 +13,14 @@ export const DecodedTransaction = ({ functionFragment, data }: Props) => { return ( {functionFragment.inputs.length > 0 && ( -
+
{functionFragment.inputs.map((input, i) => ( - - {input.name} {input.type} - + ))}
)} diff --git a/extension/src/panel/app-routes/transactions/RawTransaction.tsx b/extension/src/panel/app-routes/transactions/RawTransaction.tsx index 3f27a6ca..c6e03713 100644 --- a/extension/src/panel/app-routes/transactions/RawTransaction.tsx +++ b/extension/src/panel/app-routes/transactions/RawTransaction.tsx @@ -1,11 +1,9 @@ -import { BaseTransaction } from './BaseTransaction' +import { TextInput } from '@/components' interface Props { data: string } export const RawTransaction = ({ data }: Props) => ( - - Data - + ) diff --git a/extension/src/panel/app-routes/transactions/Transactions.tsx b/extension/src/panel/app-routes/transactions/Transactions.tsx index d2da8857..79a8f3d8 100644 --- a/extension/src/panel/app-routes/transactions/Transactions.tsx +++ b/extension/src/panel/app-routes/transactions/Transactions.tsx @@ -63,7 +63,7 @@ export const Transactions = () => { } return ( -
+
@@ -92,10 +92,10 @@ export const Transactions = () => {
-
+
{transactions.map((transactionState, index) => ( { )}
-
+
{!route.initiator && ( )} +
diff --git a/extension/src/panel/app.tsx b/extension/src/panel/app.tsx index f7e6c327..1be33154 100644 --- a/extension/src/panel/app.tsx +++ b/extension/src/panel/app.tsx @@ -30,7 +30,7 @@ const Root = () => { -
+