databag/net/web/src/session/channels/Channels.jsx

46 lines
1.3 KiB
React
Raw Normal View History

2022-08-09 18:14:36 +00:00
import { Input, List } from 'antd';
2022-08-08 06:30:34 +00:00
import { ChannelsWrapper } from './Channels.styled';
import { CommentOutlined, SearchOutlined } from '@ant-design/icons';
2022-08-09 18:14:36 +00:00
import { useChannels } from './useChannels.hook';
import { ChannelItem } from './channelItem/ChannelItem';
2022-08-08 06:30:34 +00:00
export function Channels({ open }) {
2022-08-09 18:14:36 +00:00
const { state, actions } = useChannels();
2022-08-08 06:30:34 +00:00
return (
<ChannelsWrapper onClick={open} >
<div class="search">
<div class="filter">
<Input bordered={false} allowClear={true} placeholder="Channels" prefix={<SearchOutlined />}
2022-08-16 19:13:17 +00:00
spellCheck="false" onChange={(e) => actions.onFilter(e.target.value)} />
2022-08-08 06:30:34 +00:00
</div>
{ state.display === 'small' && (
<div class="inline">
<div class="add">
<CommentOutlined />
<div class="label">New</div>
</div>
</div>
)}
</div>
<div class="view">
2022-08-09 18:14:36 +00:00
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.channels} gutter="0"
renderItem={item => (
<ChannelItem item={item} />
)}
/>
</div>
{ state.display !== 'small' && (
<div class="bar">
<div class="add">
<CommentOutlined />
<div class="label">New Channel</div>
</div>
</div>
)}
2022-08-08 06:30:34 +00:00
</ChannelsWrapper>
);
2022-08-05 22:06:53 +00:00
}