Fix copy button

This commit is contained in:
Robert Long 2021-12-13 15:49:12 -08:00
parent 2466f25d9f
commit 4d6c4bc70e
4 changed files with 11 additions and 4 deletions

View file

@ -314,6 +314,7 @@ function RoomSetupView({
<CopyButton <CopyButton
value={window.location.href} value={window.location.href}
className={styles.copyButton} className={styles.copyButton}
copiedMessage="Call link copied"
> >
Copy call link and join later Copy call link and join later
</CopyButton> </CopyButton>

View file

@ -108,7 +108,7 @@ limitations under the License.
} }
.copyButton { .copyButton {
width: auto !important; width: 320px !important;
} }
.previewButtons > * { .previewButtons > * {

View file

@ -138,7 +138,6 @@ limitations under the License.
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
flex: 1;
} }
.copyButton svg { .copyButton svg {

View file

@ -4,7 +4,14 @@ import { ReactComponent as CheckIcon } from "../icons/Check.svg";
import { ReactComponent as CopyIcon } from "../icons/Copy.svg"; import { ReactComponent as CopyIcon } from "../icons/Copy.svg";
import { Button } from "./Button"; import { Button } from "./Button";
export function CopyButton({ value, children, onClassName, variant, ...rest }) { export function CopyButton({
value,
children,
onClassName,
variant,
copiedMessage,
...rest
}) {
const [isCopied, setCopied] = useClipboard(value, { successDuration: 3000 }); const [isCopied, setCopied] = useClipboard(value, { successDuration: 3000 });
return ( return (
@ -18,7 +25,7 @@ export function CopyButton({ value, children, onClassName, variant, ...rest }) {
> >
{isCopied ? ( {isCopied ? (
<> <>
{variant !== "icon" && <span>Copied!</span>} {variant !== "icon" && <span>{copiedMessage || "Copied!"}</span>}
<CheckIcon /> <CheckIcon />
</> </>
) : ( ) : (