Create and delete tokens from web ui
This commit is contained in:
22
moneymgr_web/src/widgets/CopyTextChip.tsx
Normal file
22
moneymgr_web/src/widgets/CopyTextChip.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import { Chip, Tooltip } from "@mui/material";
|
||||
import { useSnackbar } from "../hooks/context_providers/SnackbarProvider";
|
||||
|
||||
export function CopyTextChip(p: { text: string }): React.ReactElement {
|
||||
const snackbar = useSnackbar();
|
||||
|
||||
const copyTextToClipboard = () => {
|
||||
navigator.clipboard.writeText(p.text);
|
||||
snackbar(`'${p.text}' was copied to clipboard.`);
|
||||
};
|
||||
|
||||
return (
|
||||
<Tooltip title="Copy to clipboard">
|
||||
<Chip
|
||||
label={p.text}
|
||||
variant="outlined"
|
||||
style={{ margin: "5px" }}
|
||||
onClick={copyTextToClipboard}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user