-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: wallet modal
- Loading branch information
Showing
18 changed files
with
807 additions
and
12 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
import Image from "next/image"; | ||
|
||
import { cn } from ".."; | ||
import { copyToClipboard } from "../../../subspace/utils"; | ||
|
||
interface CodeComponentProps { | ||
code: string; | ||
} | ||
|
||
export function CopyButton(props: CodeComponentProps): JSX.Element { | ||
const { code } = props; | ||
const [copied, setCopied] = useState(false); | ||
|
||
async function copyTextToClipboard(text: string): Promise<void> { | ||
setCopied(true); | ||
setTimeout(() => { | ||
setCopied(false); | ||
}, 1000); | ||
await copyToClipboard(text); | ||
|
||
return; | ||
} | ||
|
||
return ( | ||
<button | ||
className={cn( | ||
`flex w-full max-w-28 items-center justify-center border border-gray-500 py-2 text-gray-400 hover:border-green-600 hover:text-green-600 ${copied && "cursor-not-allowed border-green-500 text-green-500 hover:!border-green-500 hover:!text-green-500"}`, | ||
)} | ||
onClick={() => void copyTextToClipboard(code)} | ||
type="button" | ||
> | ||
<span className={cn(`flex items-center ${copied ? "text-green-" : ""}`)}> | ||
{!copied ? "Copy" : "Copied"}{" "} | ||
<Image | ||
alt="" | ||
className="ml-1" | ||
height={20} | ||
src="docs-icon.svg" | ||
width={20} | ||
/> | ||
</span> | ||
</button> | ||
); | ||
} |
Oops, something went wrong.