Skip to content

Commit

Permalink
add copy button to message examples (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerstock authored Oct 22, 2024
1 parent d5a9d18 commit 92f19b5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions examples/testapp/src/components/RpcMethods/RpcMethodCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,20 @@ export function RpcMethodCard({ format, method, params, shortcuts }) {
<AccordionPanel pb={4}>
<HStack spacing={2}>
{shortcuts.map((shortcut) => (
<Button key={shortcut.key} onClick={() => submit(shortcut.data)}>
{shortcut.key}
</Button>
<HStack key={shortcut.key} spacing={1}>
<Button onClick={() => submit(shortcut.data)}>
{shortcut.key}
</Button>
{shortcut.data.message && (
<Button
onClick={() => navigator.clipboard.writeText(JSON.stringify(shortcut.data.message, null, 2))}
variant="outline"
size="sm"
>
Copy
</Button>
)}
</HStack>
))}
</HStack>
</AccordionPanel>
Expand Down

0 comments on commit 92f19b5

Please sign in to comment.