Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 244x 244x 1x 1x | import React, {useState} from "react";
import {Box, TextField, Tooltip} from "@mui/material";
type Props = {
link: string
}
export default function ShareLink(props: Props) {
const [tooltip, setTooltip] = useState("Click to copy")
return (
<Box>
<h4>Share this for others to join</h4>
<Tooltip title={tooltip}>
<TextField
variant="outlined"
label="sharable link"
data-test="sharable-link"
value={props.link}
onClick={() => {
navigator.clipboard.writeText(props.link);
setTooltip("Copied!")
}}
onMouseLeave={() => setTooltip("Click to copy")}
onChange={e => e.preventDefault()}
/>
</Tooltip>
</Box>
);
}
|