diff --git a/src/react-components/input/BackButton.js b/src/react-components/input/BackButton.js new file mode 100644 index 000000000..df3e4e7c3 --- /dev/null +++ b/src/react-components/input/BackButton.js @@ -0,0 +1,24 @@ +import React from "react"; +import PropTypes from "prop-types"; +import classNames from "classnames"; +import styles from "./BackButton.scss"; +import { IconButton } from "../input/IconButton"; +import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; + +export function BackButton({ children, className, ...rest }) { + return ( + + + {children} + + ); +} + +BackButton.propTypes = { + className: PropTypes.string, + children: PropTypes.node +}; + +BackButton.defaultProps = { + children: "Back" +}; diff --git a/src/react-components/input/BackButton.scss b/src/react-components/input/BackButton.scss new file mode 100644 index 000000000..d099b45c1 --- /dev/null +++ b/src/react-components/input/BackButton.scss @@ -0,0 +1,3 @@ +:local(.back-button) { + margin-left: -8px; +} \ No newline at end of file diff --git a/src/react-components/input/CloseButton.js b/src/react-components/input/CloseButton.js new file mode 100644 index 000000000..a3a5a2123 --- /dev/null +++ b/src/react-components/input/CloseButton.js @@ -0,0 +1,11 @@ +import React from "react"; +import { IconButton } from "../input/IconButton"; +import { ReactComponent as CloseIcon } from "../icons/Close.svg"; + +export function CloseButton(props) { + return ( + + + + ); +} diff --git a/src/react-components/modal/Modal.js b/src/react-components/modal/Modal.js index c0b7f81ac..fa234a60b 100644 --- a/src/react-components/modal/Modal.js +++ b/src/react-components/modal/Modal.js @@ -2,6 +2,16 @@ import React from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; import styles from "./Modal.scss"; +import { IconButton } from "../input/IconButton"; +import { ReactComponent as CloseIcon } from "../icons/Close.svg"; + +export function CloseButton(props) { + return ( + + + + ); +} export function Modal({ title, beforeTitle, afterTitle, children, contentClassName, className, disableFullscreen }) { return ( diff --git a/src/react-components/modal/Modal.scss b/src/react-components/modal/Modal.scss index 177fc2229..882eca2fb 100644 --- a/src/react-components/modal/Modal.scss +++ b/src/react-components/modal/Modal.scss @@ -32,11 +32,13 @@ :local(.before-title) { position: absolute; left: 0; + margin-left: 16px; } :local(.after-title) { position: absolute; right: 0; + margin-right: 16px; } :local(.content) { diff --git a/src/react-components/room/AvatarSettingsSidebar.js b/src/react-components/room/AvatarSettingsSidebar.js index 4293f8dba..a53279a9e 100644 --- a/src/react-components/room/AvatarSettingsSidebar.js +++ b/src/react-components/room/AvatarSettingsSidebar.js @@ -1,6 +1,8 @@ import React from "react"; import PropTypes from "prop-types"; -import { Sidebar, BackButton, CloseButton } from "../sidebar/Sidebar"; +import { Sidebar } from "../sidebar/Sidebar"; +import { CloseButton } from "../input/CloseButton"; +import { BackButton } from "../input/BackButton"; import { AvatarSettingsContent } from "./AvatarSettingsContent"; export function AvatarSettingsSidebar({ className, showBackButton, onBack, onClose, ...rest }) { diff --git a/src/react-components/room/AvatarSetupModal.js b/src/react-components/room/AvatarSetupModal.js index 1aa939d36..0358774b1 100644 --- a/src/react-components/room/AvatarSetupModal.js +++ b/src/react-components/room/AvatarSetupModal.js @@ -1,22 +1,12 @@ import React from "react"; import PropTypes from "prop-types"; import { Modal } from "../modal/Modal"; -import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; -import { IconButton } from "../input/IconButton"; +import { BackButton } from "../input/BackButton"; import { AvatarSettingsContent } from "./AvatarSettingsContent"; export function AvatarSetupModal({ className, onBack, ...rest }) { return ( - - - Back - - } - className={className} - > + } className={className}> ); diff --git a/src/react-components/room/ChatSidebar.js b/src/react-components/room/ChatSidebar.js index 15fa63a1f..38ac37f57 100644 --- a/src/react-components/room/ChatSidebar.js +++ b/src/react-components/room/ChatSidebar.js @@ -1,7 +1,8 @@ import React, { forwardRef } from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; -import { CloseButton, Sidebar } from "../sidebar/Sidebar"; +import { Sidebar } from "../sidebar/Sidebar"; +import { CloseButton } from "../input/CloseButton"; import { ReactComponent as WandIcon } from "../icons/Wand.svg"; import { ReactComponent as AttachIcon } from "../icons/Attach.svg"; import { ReactComponent as ChatIcon } from "../icons/Chat.svg"; diff --git a/src/react-components/room/EnterOnDeviceModal.js b/src/react-components/room/EnterOnDeviceModal.js index ae65bc036..481303987 100644 --- a/src/react-components/room/EnterOnDeviceModal.js +++ b/src/react-components/room/EnterOnDeviceModal.js @@ -4,9 +4,8 @@ import classNames from "classnames"; import { Modal } from "../modal/Modal"; import { Button } from "../input/Button"; import { ReactComponent as VRIcon } from "../icons/VR.svg"; -import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; import styles from "./EnterOnDeviceModal.scss"; -import { IconButton } from "../input/IconButton"; +import { BackButton } from "../input/BackButton"; export function EnterOnDeviceModal({ className, @@ -22,12 +21,7 @@ export function EnterOnDeviceModal({ return ( - - Back - - } + beforeTitle={} className={className} contentClassName={classNames(styles.content, { [styles.loadingCode]: loadingCode })} {...rest} diff --git a/src/react-components/room/MicPermissionsModal.js b/src/react-components/room/MicPermissionsModal.js index 3906de055..b925f5e26 100644 --- a/src/react-components/room/MicPermissionsModal.js +++ b/src/react-components/room/MicPermissionsModal.js @@ -2,21 +2,15 @@ import React from "react"; import PropTypes from "prop-types"; import { Modal } from "../modal/Modal"; import { Button } from "../input/Button"; -import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; import { ReactComponent as MicrophoneIcon } from "../icons/Microphone.svg"; import styles from "./MicPermissionsModal.scss"; -import { IconButton } from "../input/IconButton"; +import { BackButton } from "../input/BackButton"; export function MicPermissionsModal({ className, error, onClickErrorButton, errorButtonLabel, onBack, ...rest }) { return ( - - Back - - } + beforeTitle={} className={className} contentClassName={styles.content} {...rest} diff --git a/src/react-components/room/MicSetupModal.js b/src/react-components/room/MicSetupModal.js index cd2eeb93e..4298da002 100644 --- a/src/react-components/room/MicSetupModal.js +++ b/src/react-components/room/MicSetupModal.js @@ -3,13 +3,12 @@ import PropTypes from "prop-types"; import classNames from "classnames"; import { Modal } from "../modal/Modal"; import { Button } from "../input/Button"; -import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; import { ReactComponent as MicrophoneIcon } from "../icons/Microphone.svg"; import { ReactComponent as MicrophoneMutedIcon } from "../icons/MicrophoneMuted.svg"; import { ReactComponent as VolumeHighIcon } from "../icons/VolumeHigh.svg"; import { ReactComponent as VolumeOffIcon } from "../icons/VolumeOff.svg"; import styles from "./MicSetupModal.scss"; -import { IconButton } from "../input/IconButton"; +import { BackButton } from "../input/BackButton"; import { SelectInputField } from "../input/SelectInputField"; import { ToggleInput } from "../input/ToggleInput"; import { ToolbarButton } from "../input/ToolbarButton"; @@ -35,12 +34,7 @@ export function MicSetupModal({ return ( - - Back - - } + beforeTitle={} className={className} contentClassName={styles.content} {...rest} diff --git a/src/react-components/room/ObjectsSidebar.js b/src/react-components/room/ObjectsSidebar.js index e9676d4da..46c48dbc5 100644 --- a/src/react-components/room/ObjectsSidebar.js +++ b/src/react-components/room/ObjectsSidebar.js @@ -2,7 +2,8 @@ import React from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; import styles from "./ObjectsSidebar.scss"; -import { Sidebar, CloseButton } from "../sidebar/Sidebar"; +import { Sidebar } from "../sidebar/Sidebar"; +import { CloseButton } from "../input/CloseButton"; import { ButtonListItem } from "../layout/List"; import listStyles from "../layout/List.scss"; import { ReactComponent as ObjectIcon } from "../icons/Object.svg"; diff --git a/src/react-components/room/PeopleSidebar.js b/src/react-components/room/PeopleSidebar.js index 0992c7bce..96298bff1 100644 --- a/src/react-components/room/PeopleSidebar.js +++ b/src/react-components/room/PeopleSidebar.js @@ -1,7 +1,9 @@ import React from "react"; import PropTypes from "prop-types"; import styles from "./PeopleSidebar.scss"; -import { Sidebar, CloseButton, SidebarButton } from "../sidebar/Sidebar"; +import { Sidebar } from "../sidebar/Sidebar"; +import { CloseButton } from "../input/CloseButton"; +import { IconButton } from "../input/IconButton"; import { ReactComponent as StarIcon } from "../icons/Star.svg"; import { ReactComponent as DesktopIcon } from "../icons/Desktop.svg"; import { ReactComponent as DiscordIcon } from "../icons/Discord.svg"; @@ -97,7 +99,7 @@ export function PeopleSidebar({ people, onSelectPerson, onClose, showMuteAll, on } - afterTitle={showMuteAll ? Mute All : undefined} + afterTitle={showMuteAll ? Mute All : undefined} > {people.map(person => { diff --git a/src/react-components/room/UserProfileSidebar.js b/src/react-components/room/UserProfileSidebar.js index 49102bd88..52603ae8b 100644 --- a/src/react-components/room/UserProfileSidebar.js +++ b/src/react-components/room/UserProfileSidebar.js @@ -1,6 +1,8 @@ import React from "react"; import PropTypes from "prop-types"; -import { Sidebar, BackButton, CloseButton } from "../sidebar/Sidebar"; +import { Sidebar } from "../sidebar/Sidebar"; +import { CloseButton } from "../input/CloseButton"; +import { BackButton } from "../input/BackButton"; import { Button } from "../input/Button"; import styles from "./UserProfileSidebar.scss"; diff --git a/src/react-components/sidebar/Sidebar.js b/src/react-components/sidebar/Sidebar.js index 2eea68ce3..ed10a8e38 100644 --- a/src/react-components/sidebar/Sidebar.js +++ b/src/react-components/sidebar/Sidebar.js @@ -2,46 +2,6 @@ import React from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; import styles from "./Sidebar.scss"; -import { IconButton } from "../input/IconButton"; -import { ReactComponent as ChevronBackIcon } from "../icons/ChevronBack.svg"; -import { ReactComponent as CloseIcon } from "../icons/Close.svg"; - -export function BackButton({ children, ...rest }) { - return ( - - - {children} - - ); -} - -BackButton.propTypes = { - children: PropTypes.node -}; - -BackButton.defaultProps = { - children: "Back" -}; - -export function CloseButton(props) { - return ( - - - - ); -} - -export function SidebarButton({ children, ...rest }) { - return ( - - {children} - - ); -} - -SidebarButton.propTypes = { - children: PropTypes.node -}; export function Sidebar({ title, beforeTitle, afterTitle, children, contentClassName, className }) { return ( diff --git a/src/react-components/sidebar/Sidebar.scss b/src/react-components/sidebar/Sidebar.scss index eb8a97b3d..ef9b51117 100644 --- a/src/react-components/sidebar/Sidebar.scss +++ b/src/react-components/sidebar/Sidebar.scss @@ -29,11 +29,13 @@ :local(.before-title) { position: absolute; left: 0; + margin-left: 16px; } :local(.after-title) { position: absolute; right: 0; + margin-right: 16px; } :local(.content) { @@ -42,17 +44,3 @@ flex-direction: column; overflow-y: auto; } - -:local(.back-button) { - margin-left: 8px; -} - -:local(.sidebar-button) { - &:first-child { - margin-left: 16px; - } - - &:last-child { - margin-right: 16px; - } -} diff --git a/src/react-components/sign-in-dialog.js b/src/react-components/sign-in-dialog.js index e34f130b1..b47b639b1 100644 --- a/src/react-components/sign-in-dialog.js +++ b/src/react-components/sign-in-dialog.js @@ -5,8 +5,9 @@ import { FormattedMessage } from "react-intl"; import configs from "../utils/configs"; import IfFeature from "./if-feature"; import styles from "../assets/stylesheets/sign-in-dialog.scss"; -import DialogContainer from "./dialog-container"; import { handleTextFieldFocus, handleTextFieldBlur } from "../utils/focus-utils"; +import { Modal } from "./modal/Modal"; +import { CloseButton } from "./input/CloseButton"; export default class SignInDialog extends Component { static propTypes = { @@ -16,6 +17,7 @@ export default class SignInDialog extends Component { onContinue: PropTypes.func, message: PropTypes.string, continueText: PropTypes.string, + onClose: PropTypes.func, closable: PropTypes.bool }; @@ -107,9 +109,9 @@ export default class SignInDialog extends Component { } return ( - + }> {contents} - + ); } } diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index 233e68a8a..0456cf907 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -1482,7 +1482,6 @@ class UIRoot extends Component {
- {this.state.dialog} {preload && this.props.hub && ( } toolbarCenter={ <>