-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add existing budget from no bidget page
- Loading branch information
1 parent
326a2d3
commit 1ab1c7e
Showing
2 changed files
with
50 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { CheckOutlined, CopyOutlined } from "@ant-design/icons"; | ||
import { Button, Flex, Input, Typography } from "antd"; | ||
import { useEffect, useState } from "react"; | ||
|
||
|
||
|
||
|
||
|
||
export function CopyToClipboard(props: { text: string, onCopy: () => void, size?: number }) { | ||
const [is_copied, setIsCopied] = useState(false); | ||
|
||
const copyToClipboard = () => { | ||
navigator.clipboard.writeText(props.text).then(() => { | ||
props.onCopy(); | ||
setIsCopied(true); | ||
}); | ||
} | ||
|
||
let button_icon = <CopyOutlined />; | ||
if (is_copied) { | ||
button_icon = <CheckOutlined />; | ||
} | ||
|
||
|
||
return ( | ||
<Flex justify="center" align="center" gap={20} style={{ width: '100%' }}> | ||
<Typography.Text style={{ fontSize: props.size }}>{props.text}</Typography.Text> | ||
<Button onClick={copyToClipboard} icon={button_icon} size="large" type="text" ></Button> | ||
</Flex> | ||
) | ||
|
||
} |
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