mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
adding contacts section of sidebar
This commit is contained in:
parent
1d3d1a44a8
commit
3f9741acda
14
net/web/src/User/SideBar/Contacts/Contacts.jsx
Normal file
14
net/web/src/User/SideBar/Contacts/Contacts.jsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Avatar, Image } from 'antd';
|
||||||
|
import React from 'react'
|
||||||
|
import { ContactsWrapper } from './Contacts.styled';
|
||||||
|
import { useContacts } from './useContacts.hook';
|
||||||
|
|
||||||
|
export function Contacts() {
|
||||||
|
|
||||||
|
const { state, actions } = useContacts()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ContactsWrapper>
|
||||||
|
</ContactsWrapper>
|
||||||
|
)
|
||||||
|
}
|
12
net/web/src/User/SideBar/Contacts/Contacts.styled.jsx
Normal file
12
net/web/src/User/SideBar/Contacts/Contacts.styled.jsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { Button } from 'antd';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export const ContactsWrapper = styled.div`
|
||||||
|
width: 100%;
|
||||||
|
flex-grow: 1;
|
||||||
|
border-top-left-radius: 8px;
|
||||||
|
border-top-right-radius: 8px;
|
||||||
|
background-color: #f6f5ed;
|
||||||
|
border-top: 1px solid #8fbea7;
|
||||||
|
border-right: 1px solid #8fbea7;
|
||||||
|
`;
|
19
net/web/src/User/SideBar/Contacts/useContacts.hook.js
Normal file
19
net/web/src/User/SideBar/Contacts/useContacts.hook.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { useContext, useState, useEffect } from 'react';
|
||||||
|
import { AppContext } from '../../../AppContext/AppContext';
|
||||||
|
|
||||||
|
export function useContacts() {
|
||||||
|
|
||||||
|
const [state, setState] = useState({});
|
||||||
|
|
||||||
|
const actions = {};
|
||||||
|
|
||||||
|
const app = useContext(AppContext);
|
||||||
|
|
||||||
|
const updateState = (value) => {
|
||||||
|
setState((s) => ({ ...s, ...value }));
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {}, [app])
|
||||||
|
|
||||||
|
return { state, actions };
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import { Avatar, Image } from 'antd';
|
import { Avatar, Image } from 'antd';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { IdentityWrapper } from './Identity.styled';
|
import { IdentityWrapper } from './Identity.styled';
|
||||||
import { DownOutlined, EditOutlined, UserOutlined } from '@ant-design/icons';
|
import { RightOutlined, EditOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { useIdentity } from './useIdentity.hook';
|
import { useIdentity } from './useIdentity.hook';
|
||||||
import { Menu, Dropdown } from 'antd';
|
import { Menu, Dropdown } from 'antd';
|
||||||
|
|
||||||
@ -10,10 +10,13 @@ export function Identity() {
|
|||||||
const { state, actions } = useIdentity()
|
const { state, actions } = useIdentity()
|
||||||
|
|
||||||
const Logo = () => {
|
const Logo = () => {
|
||||||
if (state.imageUrl === '') {
|
if (state.imageUrl != null) {
|
||||||
return <Avatar size={64} icon={<UserOutlined />} />
|
if (state.imageUrl === '') {
|
||||||
|
return <UserOutlined />
|
||||||
|
}
|
||||||
|
return <img class="logo" src={ state.imageUrl } alt="" />
|
||||||
}
|
}
|
||||||
return <Avatar size={64} src={<Image preview={false} src={ state.imageUrl } style={{ width: 64 }} />} />
|
return <></>
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
@ -29,17 +32,17 @@ export function Identity() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<IdentityWrapper>
|
<IdentityWrapper>
|
||||||
<Dropdown overlay={menu} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="bottomRight">
|
<Dropdown overlay={menu} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="right">
|
||||||
<div>
|
<div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="logo">
|
<div class="avatar">
|
||||||
<Logo />
|
<Logo />
|
||||||
</div>
|
</div>
|
||||||
<div class="username">
|
<div class="username">
|
||||||
<span class="name">{ state.name }</span>
|
<span class="name">{ state.name }</span>
|
||||||
<span class="handle">{ state.handle }</span>
|
<span class="handle">{ state.handle }</span>
|
||||||
</div>
|
</div>
|
||||||
<DownOutlined />
|
<RightOutlined />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
@ -2,12 +2,11 @@ import { Button } from 'antd';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
export const IdentityWrapper = styled.div`
|
export const IdentityWrapper = styled.div`
|
||||||
background-color: #f6f5ed;
|
|
||||||
border-bottom: 2px solid #8fbea7;
|
|
||||||
border-top: 1px solid #8fbea7;
|
border-top: 1px solid #8fbea7;
|
||||||
border-left: 0px;
|
border-right: 1px solid #8fbea7;
|
||||||
border-right: 0px;
|
border-bottom: 1px solid #8fbea7;
|
||||||
border-radius: 0px;
|
overflow: hidden;
|
||||||
|
border-radius: 8px;
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -19,19 +18,14 @@ export const IdentityWrapper = styled.div`
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
}
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
.menu {
|
background-color: #f6f5ed;
|
||||||
min-width: 0px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 33%
|
width: 100%;
|
||||||
display: flex;
|
height: 100%;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding-top: 4px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
@ -43,12 +37,16 @@ export const IdentityWrapper = styled.div`
|
|||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit {
|
.avatar {
|
||||||
position: absolute;
|
color: #888888;
|
||||||
|
font-size: 3em;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: center;
|
||||||
right: 0;
|
justify-content: center;
|
||||||
bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
@ -59,10 +57,7 @@ export const IdentityWrapper = styled.div`
|
|||||||
.handle {
|
.handle {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
color: #444444;
|
color: #444444;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.domain {
|
|
||||||
font-size: 1em;
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
@ -7,7 +7,7 @@ export function useIdentity() {
|
|||||||
name: '',
|
name: '',
|
||||||
handle: '',
|
handle: '',
|
||||||
domain: '',
|
domain: '',
|
||||||
imageUrl: ''
|
imageUrl: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { SideBarWrapper } from './SideBar.styled';
|
import { SideBarWrapper } from './SideBar.styled';
|
||||||
import { Identity } from './Identity/Identity';
|
import { Identity } from './Identity/Identity';
|
||||||
|
import { Contacts } from './Contacts/Contacts';
|
||||||
|
|
||||||
export function SideBar() {
|
export function SideBar() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SideBarWrapper>
|
<SideBarWrapper>
|
||||||
<Identity />
|
<Identity />
|
||||||
|
<Contacts />
|
||||||
</SideBarWrapper>
|
</SideBarWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ export const SideBarWrapper = styled.div`
|
|||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
border: 1px solid #8fbea7;
|
border: 1px solid #8fbea7;
|
||||||
|
background-color: #8fbea7;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
`;
|
`;
|
||||||
|
@ -15,7 +15,6 @@ export function User() {
|
|||||||
<SideBar />
|
<SideBar />
|
||||||
<div class="canvas">
|
<div class="canvas">
|
||||||
<img class="connect" src={connect} alt="" />
|
<img class="connect" src={connect} alt="" />
|
||||||
<Button type="primary" onClick={() => actions.onLogout()} style={{ alignSelf: 'center', marginTop: '16px', width: '33%' }}>Sign Out</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</UserWrapper>
|
</UserWrapper>
|
||||||
)
|
)
|
||||||
|
@ -13,7 +13,7 @@ export const UserWrapper = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 1px solid #8fbea7;
|
background-color: #8fbea7;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,6 @@ export function useUser() {
|
|||||||
const app = useContext(AppContext);
|
const app = useContext(AppContext);
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
onLogout: async () => {
|
|
||||||
app.actions.logout()
|
|
||||||
},
|
|
||||||
updateState: (value) => {
|
updateState: (value) => {
|
||||||
setState((s) => ({ ...s, ...value }));
|
setState((s) => ({ ...s, ...value }));
|
||||||
},
|
},
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 66 KiB |
Loading…
Reference in New Issue
Block a user