Skip to content

Commit

Permalink
feat: add modals header, title and body
Browse files Browse the repository at this point in the history
  • Loading branch information
SplitCode committed Nov 4, 2024
1 parent c5d500a commit d2dd307
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions frontend/src/components/modals/ModalComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useSelector, useDispatch } from 'react-redux';
import { Modal as BootstrapModal } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { selectIsOpen, closeModal, selectType } from '../../store/slices/modalsSlice';
import { MODALS } from './constants';

const Modal = () => {
const dispatch = useDispatch();
const isOpen = useSelector(selectIsOpen);
const type = useSelector(selectType);
const { t } = useTranslation();

const handleClose = () => {
dispatch(closeModal());
Expand All @@ -16,30 +18,16 @@ const Modal = () => {

return (
<BootstrapModal show={isOpen} onHide={handleClose} centered>
{Component && <Component handleClose={handleClose} />}
<BootstrapModal.Header closeButton>
<BootstrapModal.Title>
{t(`modals.${type}ChannelTitle`)}
</BootstrapModal.Title>
</BootstrapModal.Header>
<BootstrapModal.Body>
{Component && <Component handleClose={handleClose} />}
</BootstrapModal.Body>
</BootstrapModal>
);
};

export default Modal;

// return ModalContent ? (
// <Modal show={isOpened} onHide={handleClose} centered>
// <Modal.Header closeButton>
// <Modal.Title>
// {t(`modals.${modalType}ChannelTitle`)}
// </Modal.Title>
// </Modal.Header>
// <Modal.Body>
// <ModalContent
// handleClose={handleCloseModal}
// inputRef={inputRef}
// handleSelectChannel={handleSelectChannel}
// currentChannelId={currentChannelId}
// channelId={channelId}
// channelName={channelName}
// t={t}
// />
// </Modal.Body>
// </Modal>
// ) : null;

0 comments on commit d2dd307

Please sign in to comment.