From eb2b540111316b225125d5b564b87581f0616671 Mon Sep 17 00:00:00 2001 From: Ivan Samozhenov Date: Wed, 29 Nov 2023 22:57:56 +0300 Subject: [PATCH] Insert modals logic into ChannelsList component --- .../src/components/chat/ChannelsListArea.jsx | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/chat/ChannelsListArea.jsx b/frontend/src/components/chat/ChannelsListArea.jsx index a919d28..162d81d 100644 --- a/frontend/src/components/chat/ChannelsListArea.jsx +++ b/frontend/src/components/chat/ChannelsListArea.jsx @@ -7,9 +7,10 @@ import { } from 'react-bootstrap'; import { PlusSquare } from 'react-bootstrap-icons'; -import { removeChannel } from '../../slices/channelsSlice'; // and other actions +import { openModal, closeModal } from '../../slices/modalsSlice'; +import getModal from '../modals/index'; -const generateChannelButton = (name, removable, variant, handleRemove) => { +const generateChannelButton = (name, removable, variant, handleOpen) => { const ChannelButton = ( @@ -61,14 +82,15 @@ const ChatChannels = () => { name, removable, variant, - handleChannelRemove(id), + (action) => handleOpenModal(action, id), )} ); })} + {renderModal(handleCloseModal, modalState)} ); }; -export default ChatChannels; +export default ChannelsListArea;