All checks were successful
continuous-integration/drone/push Build is passing
Add a new module to enable accommodations reservation  Reviewed-on: #188
31 lines
728 B
TypeScript
31 lines
728 B
TypeScript
import { ButtonBase } from "@mui/material";
|
|
import { PropsWithChildren } from "react";
|
|
import { useSnackbar } from "../hooks/context_providers/SnackbarProvider";
|
|
|
|
export function CopyToClipboard(
|
|
p: PropsWithChildren<{ content: string }>
|
|
): React.ReactElement {
|
|
const snackbar = useSnackbar();
|
|
|
|
const copy = () => {
|
|
navigator.clipboard.writeText(p.content);
|
|
snackbar(`${p.content} a été copié dans le presse papier.`);
|
|
};
|
|
|
|
return (
|
|
<ButtonBase
|
|
onClick={copy}
|
|
style={{
|
|
display: "inline-block",
|
|
alignItems: "unset",
|
|
textAlign: "unset",
|
|
position: "relative",
|
|
padding: "0px",
|
|
}}
|
|
disableRipple
|
|
>
|
|
{p.children}
|
|
</ButtonBase>
|
|
);
|
|
}
|