Skip to content

Commit

Permalink
feat: add action to Button.Transaction.
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Mar 7, 2024
1 parent 35eba25 commit 51610c2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-taxis-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"frog": patch
---

Added `action` prop to `Button.Transaction`.
6 changes: 6 additions & 0 deletions site/pages/intents/button-transaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ app.frame('/', (c) => {

## Props

### action (optional)

- **Type:** `string`

Path of the next frame to perform a `POST` request.

### target

- **Type:** `string`
Expand Down
6 changes: 6 additions & 0 deletions site/pages/intents/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ app.frame('/', (c) => {

## Props

### action (optional)

- **Type:** `string`

Path of the next frame to perform a `POST` request.

### value (optional)

- **Type:** `string`
Expand Down
5 changes: 5 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ export function ButtonReset({
}

export type ButtonTransactionProps = ButtonProps & {
action?: string | undefined
target: string
}

ButtonTransaction.__type = 'button'
export function ButtonTransaction({
action,
children,
// @ts-ignore - private
index = 1,
Expand All @@ -146,6 +148,9 @@ export function ButtonTransaction({
/>,
<meta property={`fc:frame:button:${index}:action`} content="tx" />,
<meta property={`fc:frame:button:${index}:target`} content={target} />,
action && (
<meta property={`fc:frame:button:${index}:post_url`} content={action} />
),
] as unknown as HtmlEscapedString
}

Expand Down

0 comments on commit 51610c2

Please sign in to comment.