mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
Created Reusable components for: - ListItem - used by participants list and lobby participants list - ContextMenu - used by participant context menu and advanced moderation context menu - Quick action button - used by quick action buttons on participant list items Moved participants custom theme to base/components/themes Created reusable button component for all participants pane buttons (Invite, Mute All, More) Moved web components to web folder Moved all styles from Styled Components to JSS Fixed accessibility labels for some buttons Removed unused code Updated all styles to use theme tokens
82 lines
1.7 KiB
JavaScript
82 lines
1.7 KiB
JavaScript
// @flow
|
|
|
|
import { makeStyles } from '@material-ui/core';
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
|
type Props = {
|
|
|
|
/**
|
|
* The component(s) to be displayed within the drawer menu.
|
|
*/
|
|
children: React$Node,
|
|
|
|
/**
|
|
* Whether the drawer should be shown or not.
|
|
*/
|
|
isOpen: boolean,
|
|
|
|
/**
|
|
* Function that hides the drawer.
|
|
*/
|
|
onClose: Function
|
|
};
|
|
|
|
const useStyles = makeStyles(theme => {
|
|
return {
|
|
drawer: {
|
|
backgroundColor: theme.palette.ui02
|
|
}
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Component that displays the mobile friendly drawer on web.
|
|
*
|
|
* @returns {ReactElement}
|
|
*/
|
|
function Drawer({
|
|
children,
|
|
isOpen,
|
|
onClose
|
|
}: Props) {
|
|
const styles = useStyles();
|
|
|
|
/**
|
|
* Handles clicks within the menu, preventing the propagation of the click event.
|
|
*
|
|
* @param {Object} event - The click event.
|
|
* @returns {void}
|
|
*/
|
|
const handleInsideClick = useCallback(event => {
|
|
event.stopPropagation();
|
|
}, []);
|
|
|
|
/**
|
|
* Handles clicks outside of the menu, closing it, and also stopping further propagation.
|
|
*
|
|
* @param {Object} event - The click event.
|
|
* @returns {void}
|
|
*/
|
|
const handleOutsideClick = useCallback(event => {
|
|
event.stopPropagation();
|
|
onClose();
|
|
}, [ onClose ]);
|
|
|
|
return (
|
|
isOpen ? (
|
|
<div
|
|
className = 'drawer-menu-container'
|
|
onClick = { handleOutsideClick }>
|
|
<div
|
|
className = { `drawer-menu ${styles.drawer}` }
|
|
onClick = { handleInsideClick }>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
) : null
|
|
);
|
|
}
|
|
|
|
export default Drawer;
|