import React, { useEffect, useState } from 'react'; import Icon from './Icon'; import useOnKey from '../../hooks/useOnKey'; type SidePanelProps = { children: React.ReactNode, closePanel: Function, title?: string, width?: 'large' | 'medium' | 'small', position?: 'left' | 'right' } const SidePanel = ({ children, closePanel, width, position = 'right', title = '' }:SidePanelProps) => { useOnKey('Escape', closePanel); const closeOnBGClick = (e:React.SyntheticEvent) => { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); if (e.target === e.currentTarget) { closePanel(); } }; return (

{title}

{children}
); }; export default SidePanel;