From 742fdab56d2f4ad60f256e7543ea2a63cd4e91d0 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Fri, 3 Dec 2021 13:17:44 -0800 Subject: [PATCH] Invite modal --- src/CopyButton.module.css | 12 ++++++-- src/InviteModal.jsx | 25 ++++++++++----- src/Modal.jsx | 2 +- src/Modal.module.css | 2 +- src/Overlay.jsx | 3 +- src/Room.jsx | 11 ++----- src/RoomButton.jsx | 64 +++++++++++++++++++-------------------- 7 files changed, 65 insertions(+), 54 deletions(-) diff --git a/src/CopyButton.module.css b/src/CopyButton.module.css index ac1cd59..c4826b5 100644 --- a/src/CopyButton.module.css +++ b/src/CopyButton.module.css @@ -4,20 +4,28 @@ justify-content: center; align-items: center; background-color: transparent; - padding: 0; cursor: pointer; border: 2px solid #0dbd8b; border-radius: 8px; color: #0dbd8b; width: 100%; - transition: border-color 250ms, background-color 250ms; height: 40px; + transition: border-color 250ms, background-color 250ms; + padding: 0 20px; } .copyButton span { font-weight: 600; font-size: 15px; margin-right: 10px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + flex: 1; +} + +.copyButton svg { + flex-shrink: 0; } .copyButton:not(.copied) svg * { diff --git a/src/InviteModal.jsx b/src/InviteModal.jsx index 18c35ac..7986896 100644 --- a/src/InviteModal.jsx +++ b/src/InviteModal.jsx @@ -1,14 +1,25 @@ import React from "react"; +import { Overlay } from "./Overlay"; import { Modal, ModalContent } from "./Modal"; import { CopyButton } from "./CopyButton"; +import { HeaderButton, ButtonTooltip } from "./RoomButton"; +import { ReactComponent as AddUserIcon } from "./icons/AddUser.svg"; -export function InviteModal({ roomUrl, ...rest }) { +export function InviteModalButton({ roomUrl }) { return ( - - -

Copy and share this meeting link

- -
-
+ + + Add User + + + {(modalProps) => ( + + +

Copy and share this meeting link

+ +
+
+ )} +
); } diff --git a/src/Modal.jsx b/src/Modal.jsx index cd89c6a..25fdb2f 100644 --- a/src/Modal.jsx +++ b/src/Modal.jsx @@ -21,7 +21,7 @@ export function Modal(props) { const { dialogProps, titleProps } = useDialog(props, modalRef); const closeButtonRef = useRef(); const { buttonProps: closeButtonProps } = useButton({ - onPress: () => props.close(), + onPress: () => props.onClose(), }); return ( diff --git a/src/Modal.module.css b/src/Modal.module.css index 8284ccc..a466844 100644 --- a/src/Modal.module.css +++ b/src/Modal.module.css @@ -15,7 +15,7 @@ background: #21262c; box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15); border-radius: 8px; - min-width: 420px; + width: 420px; } .modalHeader { diff --git a/src/Overlay.jsx b/src/Overlay.jsx index d25bc3e..499c4f7 100644 --- a/src/Overlay.jsx +++ b/src/Overlay.jsx @@ -53,7 +53,8 @@ export function Overlay({ children }) { {...buttonProps} ref={buttonRef} /> - {overlayState.isOpen && overlay({ ...overlayState })} + {overlayState.isOpen && + overlay({ isOpen: overlayState.isOpen, onClose: overlayState.close })} ); } diff --git a/src/Room.jsx b/src/Room.jsx index bac2a96..49c4f71 100644 --- a/src/Room.jsx +++ b/src/Room.jsx @@ -24,7 +24,6 @@ import { LayoutToggleButton, ScreenshareButton, DropdownButton, - InviteButton, } from "./RoomButton"; import { Header, @@ -48,8 +47,7 @@ import { fetchGroupCall } from "./ConferenceCallManagerHooks"; import { ErrorModal } from "./ErrorModal"; import { GroupCallInspector } from "./GroupCallInspector"; import * as Sentry from "@sentry/react"; -import { Overlay } from "./Overlay"; -import { InviteModal } from "./InviteModal"; +import { InviteModalButton } from "./InviteModal"; const canScreenshare = "getDisplayMedia" in navigator.mediaDevices; // There is currently a bug in Safari our our code with cloning and sending MediaStreams @@ -507,12 +505,7 @@ function InRoomView({ - - - {(props) => ( - - )} - + - {children} - - ); -} +export const RoomButton = forwardRef( + ({ on, className, children, ...rest }, ref) => { + return ( + + ); + } +); export function DropdownButton({ onChange, options, value, children }) { const buttonRef = useRef(); @@ -124,18 +128,21 @@ export function HangupButton({ className, ...rest }) { ); } -export function HeaderButton({ on, className, children, ...rest }) { - return ( - - ); -} +export const HeaderButton = forwardRef( + ({ on, className, children, ...rest }, ref) => { + return ( + + ); + } +); export function HeaderDropdownButton({ children, content }) { const buttonRef = useRef(); @@ -212,15 +219,6 @@ export function SettingsButton(props) { ); } -export function InviteButton(props) { - return ( - - Add User - - - ); -} - export function LayoutToggleButton({ layout, setLayout, ...rest }) { return (