dispatch/client/js/components/modals/Topic.js

30 lines
836 B
JavaScript
Raw Normal View History

2019-01-25 02:57:58 +00:00
import React from 'react';
2020-05-03 07:05:16 +00:00
import Modal from 'react-modal';
import { useSelector } from 'react-redux';
2020-04-29 01:10:13 +00:00
import { FiX } from 'react-icons/fi';
2020-06-30 11:24:23 +00:00
import Text from 'components/Text';
2020-04-29 01:10:13 +00:00
import Button from 'components/ui/Button';
2020-05-03 07:05:16 +00:00
import useModal from 'components/modals/useModal';
import { getSelectedChannel } from 'state/channels';
2019-01-25 02:57:58 +00:00
import { linkify } from 'utils';
2020-05-03 07:05:16 +00:00
const Topic = () => {
const [modal, channel, closeModal] = useModal('topic');
const topic = useSelector(state => getSelectedChannel(state)?.topic);
2019-01-25 02:57:58 +00:00
return (
2020-05-03 07:05:16 +00:00
<Modal {...modal}>
2019-01-25 02:57:58 +00:00
<div className="modal-header">
<h2>Topic in {channel}</h2>
2020-05-03 07:05:16 +00:00
<Button icon={FiX} className="modal-close" onClick={closeModal} />
2019-01-25 02:57:58 +00:00
</div>
2020-06-30 11:24:23 +00:00
<p className="modal-content">
<Text>{linkify(topic)}</Text>
</p>
2020-05-03 07:05:16 +00:00
</Modal>
2019-01-25 02:57:58 +00:00
);
};
2020-05-03 07:05:16 +00:00
export default Topic;