-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix layout of transaction list (#208)
- Loading branch information
1 parent
a9aa51a
commit 3443792
Showing
7 changed files
with
40 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className="flex flex-col gap-2"> | ||
<label htmlFor={id}>{label}</label> | ||
<label htmlFor={inputId}>{label}</label> | ||
|
||
{children({ inputId, descriptionId })} | ||
|
||
{children(id)} | ||
{description && ( | ||
<span className="opacity-70" id={descriptionId}> | ||
{description} | ||
</span> | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
extension/src/panel/app-routes/transactions/BaseTransaction.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
extension/src/panel/app-routes/transactions/RawTransaction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { BaseTransaction } from './BaseTransaction' | ||
import { TextInput } from '@/components' | ||
|
||
interface Props { | ||
data: string | ||
} | ||
|
||
export const RawTransaction = ({ data }: Props) => ( | ||
<BaseTransaction value={data || ''}> | ||
<span>Data</span> | ||
</BaseTransaction> | ||
<TextInput readOnly defaultValue={data || ''} label="Data" /> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters