mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
Show GIF menu in reactions menu Search GIFs using the GIPHY API Show GIFs as images in chat Show GIFs on the thumbnail of the participant that sent it Move GIF focus using up/ down arrows and send with Enter Added analytics
91 lines
1.9 KiB
JavaScript
91 lines
1.9 KiB
JavaScript
// @flow
|
|
|
|
import { makeStyles } from '@material-ui/core';
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { DRAWER_MAX_HEIGHT } from '../../constants';
|
|
|
|
|
|
type Props = {
|
|
|
|
/**
|
|
* Class name for custom styles.
|
|
*/
|
|
className: string,
|
|
|
|
/**
|
|
* 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,
|
|
maxHeight: `calc(${DRAWER_MAX_HEIGHT})`
|
|
}
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Component that displays the mobile friendly drawer on web.
|
|
*
|
|
* @returns {ReactElement}
|
|
*/
|
|
function Drawer({
|
|
children,
|
|
className = '',
|
|
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} ${className}` }
|
|
onClick = { handleInsideClick }>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
) : null
|
|
);
|
|
}
|
|
|
|
export default Drawer;
|