Format topic
This commit is contained in:
parent
307573830a
commit
1fe4c4d17e
File diff suppressed because one or more lines are too long
@ -8,6 +8,7 @@ import Button from 'components/ui/Button';
|
|||||||
import { join } from 'state/channels';
|
import { join } from 'state/channels';
|
||||||
import { searchChannels } from 'state/channelSearch';
|
import { searchChannels } from 'state/channelSearch';
|
||||||
import { linkify } from 'utils';
|
import { linkify } from 'utils';
|
||||||
|
import colorify from 'utils/colorify';
|
||||||
|
|
||||||
const Channel = memo(({ network, name, topic, userCount, joined }) => {
|
const Channel = memo(({ network, name, topic, userCount, joined }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -35,7 +36,7 @@ const Channel = memo(({ network, name, topic, userCount, joined }) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="modal-channel-topic">
|
<p className="modal-channel-topic">
|
||||||
<Text>{linkify(topic)}</Text>
|
<Text>{colorify(linkify(topic))}</Text>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,7 @@ import Button from 'components/ui/Button';
|
|||||||
import useModal from 'components/modals/useModal';
|
import useModal from 'components/modals/useModal';
|
||||||
import { getSelectedChannel } from 'state/channels';
|
import { getSelectedChannel } from 'state/channels';
|
||||||
import { linkify } from 'utils';
|
import { linkify } from 'utils';
|
||||||
|
import colorify from 'utils/colorify';
|
||||||
|
|
||||||
const Topic = () => {
|
const Topic = () => {
|
||||||
const [modal, channel, closeModal] = useModal('topic');
|
const [modal, channel, closeModal] = useModal('topic');
|
||||||
@ -20,7 +21,7 @@ const Topic = () => {
|
|||||||
<Button icon={FiX} className="modal-close" onClick={closeModal} />
|
<Button icon={FiX} className="modal-close" onClick={closeModal} />
|
||||||
</div>
|
</div>
|
||||||
<p className="modal-content">
|
<p className="modal-content">
|
||||||
<Text>{linkify(topic)}</Text>
|
<Text>{colorify(linkify(topic))}</Text>
|
||||||
</p>
|
</p>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@ -329,6 +329,10 @@ function colorifyString(str, state = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function colorify(blocks) {
|
export default function colorify(blocks) {
|
||||||
|
if (!blocks) {
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
let colored;
|
let colored;
|
||||||
let state;
|
let state;
|
||||||
|
Loading…
Reference in New Issue
Block a user