feat: channel active state

This commit is contained in:
cha0s 2020-07-21 01:00:26 -05:00
parent 7958d104fc
commit d1d24be1d7

View File

@ -1,5 +1,7 @@
import './channel.scss';
import classnames from 'classnames';
import {getLocation} from 'connected-react-router';
import PropTypes from 'prop-types';
import React from 'react';
import {Link} from 'react-router-dom';
@ -14,6 +16,7 @@ export default function Channel(props) {
name,
prefix,
} = props;
const location = useSelector(getLocation);
const unread = useSelector((state) => unreadForChannelSelector(state, `${prefix}${name}`));
const content = (
<>
@ -32,7 +35,9 @@ export default function Channel(props) {
</>
);
return (
<li className="channel__item">
<li
className={classnames('channel__item', {active: location.pathname === href})}
>
<div className="channel">
{React.cloneElement(
href ? <Link to={href} /> : <div />,