mirror of
https://github.com/balzack/databag.git
synced 2025-02-15 04:59:16 +00:00
adding new button to channels container
This commit is contained in:
parent
eeceb9a46f
commit
77156fadda
@ -1,6 +1,6 @@
|
|||||||
const Colors = {
|
const Colors = {
|
||||||
background: '#8fbea7',
|
background: '#8fbea7',
|
||||||
primary: '#8fbea7',
|
primary: '#448866',
|
||||||
formBackground: '#f4f4f4',
|
formBackground: '#f4f4f4',
|
||||||
formHover: '#e8e8e8',
|
formHover: '#e8e8e8',
|
||||||
grey: '#888888',
|
grey: '#888888',
|
||||||
|
@ -33,10 +33,12 @@ export function Session() {
|
|||||||
return (
|
return (
|
||||||
<SessionWrapper>
|
<SessionWrapper>
|
||||||
{ (viewport.state.display === 'xlarge') && (
|
{ (viewport.state.display === 'xlarge') && (
|
||||||
<div class="desktop-layout">
|
<div class="desktop-layout noselect">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<Identity />
|
<Identity />
|
||||||
<Channels />
|
<div class="bottom">
|
||||||
|
<Channels />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
{ state.conversation && (
|
{ state.conversation && (
|
||||||
@ -71,10 +73,12 @@ export function Session() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ (viewport.state.display === 'large' || viewport.state.display === 'medium') && (
|
{ (viewport.state.display === 'large' || viewport.state.display === 'medium') && (
|
||||||
<div class="tablet-layout">
|
<div class="tablet-layout noselect">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<Identity />
|
<Identity />
|
||||||
<Channels />
|
<div class="bottom">
|
||||||
|
<Channels />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<Welcome />
|
<Welcome />
|
||||||
@ -107,7 +111,7 @@ export function Session() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ (viewport.state.display === 'small') && (
|
{ (viewport.state.display === 'small') && (
|
||||||
<div class="mobile-layout">
|
<div class="mobile-layout noselect">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="reframe">
|
<div class="reframe">
|
||||||
<Channels />
|
<Channels />
|
||||||
|
@ -26,6 +26,10 @@ export const SessionWrapper = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
height: calc(100% - 64px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.center {
|
.center {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
@ -59,6 +63,10 @@ export const SessionWrapper = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
height: calc(100% - 64px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.center {
|
.center {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -3,6 +3,7 @@ import { ChannelsWrapper } from './Channels.styled';
|
|||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
import { useChannels } from './useChannels.hook';
|
import { useChannels } from './useChannels.hook';
|
||||||
import { ChannelItem } from './channelItem/ChannelItem';
|
import { ChannelItem } from './channelItem/ChannelItem';
|
||||||
|
import { AddTopic } from './addTopic/AddTopic';
|
||||||
|
|
||||||
export function Channels() {
|
export function Channels() {
|
||||||
|
|
||||||
@ -10,19 +11,20 @@ export function Channels() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ChannelsWrapper>
|
<ChannelsWrapper>
|
||||||
<div class="search">
|
<div class="view">
|
||||||
<div class="filter">
|
<div class="search">
|
||||||
<Input bordered={false} allowClear={true} placeholder="Channels" prefix={<SearchOutlined />}
|
<div class="filter">
|
||||||
size="large" spellCheck="false" onChange={(e) => actions.onFilter(e.target.value)} />
|
<Input bordered={false} allowClear={true} placeholder="Channels" prefix={<SearchOutlined />}
|
||||||
|
size="large" spellCheck="false" onChange={(e) => actions.onFilter(e.target.value)} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="results">
|
|
||||||
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.channels} gutter="0"
|
<List local={{ emptyText: '' }} itemLayout="horizontal" dataSource={state.channels} gutter="0"
|
||||||
renderItem={item => (
|
renderItem={item => (
|
||||||
<ChannelItem item={item} />
|
<ChannelItem item={item} />
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<AddTopic />
|
||||||
</ChannelsWrapper>
|
</ChannelsWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,21 @@ export const ChannelsWrapper = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: ${Colors.formBackground};
|
background-color: ${Colors.formBackground};
|
||||||
min-height: 0;
|
|
||||||
overflow: scroll;
|
|
||||||
|
|
||||||
.search {
|
.view {
|
||||||
padding: 16px;
|
min-height: 0;
|
||||||
border-bottom: 1px solid ${Colors.divider};
|
overflow: scroll;
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
.filter {
|
.search {
|
||||||
border: 1px solid ${Colors.divider};
|
padding: 16px;
|
||||||
background-color: ${Colors.white};
|
border-bottom: 1px solid ${Colors.divider};
|
||||||
border-radius: 8px;
|
|
||||||
|
.filter {
|
||||||
|
border: 1px solid ${Colors.divider};
|
||||||
|
background-color: ${Colors.white};
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.results {
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
25
net/web/src/session/channels/addTopic/AddTopic.jsx
Normal file
25
net/web/src/session/channels/addTopic/AddTopic.jsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { AddTopicWrapper } from './AddTopic.styled';
|
||||||
|
import { CommentOutlined } from '@ant-design/icons';
|
||||||
|
import { useAddTopic } from './useAddTopic.hook';
|
||||||
|
|
||||||
|
export function AddTopic() {
|
||||||
|
|
||||||
|
const { state, actions } = useAddTopic();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AddTopicWrapper>
|
||||||
|
{ state.mode === 'bar' && (
|
||||||
|
<div class="bar">
|
||||||
|
<div class="add">
|
||||||
|
<CommentOutlined />
|
||||||
|
<div class="label">New Topic</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ state.mode === 'button' && (
|
||||||
|
<div class="button">New Topic</div>
|
||||||
|
)}
|
||||||
|
</AddTopicWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
52
net/web/src/session/channels/addTopic/AddTopic.styled.js
Normal file
52
net/web/src/session/channels/addTopic/AddTopic.styled.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
import Colors from 'constants/Colors';
|
||||||
|
|
||||||
|
export const AddTopicWrapper = styled.div`
|
||||||
|
|
||||||
|
.button {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 32px;
|
||||||
|
right: 32px;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
background-color: ${Colors.primary};
|
||||||
|
color: ${Colors.white};
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
height: 64px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: ${Colors.formBackground};
|
||||||
|
border-top: 2px solid ${Colors.divider};
|
||||||
|
|
||||||
|
.add {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
background-color: ${Colors.primary};
|
||||||
|
color: ${Colors.white};
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding-left: 16px;
|
||||||
|
padding-right: 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
30
net/web/src/session/channels/addTopic/useAddTopic.hook.js
Normal file
30
net/web/src/session/channels/addTopic/useAddTopic.hook.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { useState, useEffect, useContext } from 'react';
|
||||||
|
import { ViewportContext } from 'context/ViewportContext';
|
||||||
|
|
||||||
|
export function useAddTopic() {
|
||||||
|
|
||||||
|
const [state, setState] = useState({
|
||||||
|
mode: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const viewport = useContext(ViewportContext);
|
||||||
|
|
||||||
|
const updateState = (value) => {
|
||||||
|
setState((s) => ({ ...s, ...value }));
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (viewport.state.display === 'small') {
|
||||||
|
updateState({ mode: 'button' });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateState({ mode: 'bar' });
|
||||||
|
}
|
||||||
|
}, [viewport]);
|
||||||
|
|
||||||
|
const actions = {
|
||||||
|
};
|
||||||
|
|
||||||
|
return { state, actions };
|
||||||
|
}
|
||||||
|
|
@ -9,8 +9,9 @@ export const IdentityWrapper = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
border-bottom: 3px solid ${Colors.divider};
|
border-bottom: 2px solid ${Colors.divider};
|
||||||
background-color: ${Colors.formBackground};
|
background-color: ${Colors.formBackground};
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
Loading…
Reference in New Issue
Block a user