Change members UI (#38)
This commit is contained in:
parent
8346801e51
commit
aad475a435
|
@ -120,10 +120,10 @@ export function Channel({
|
||||||
# {channel.name}
|
# {channel.name}
|
||||||
</ChannelName>
|
</ChannelName>
|
||||||
{activeView && (
|
{activeView && (
|
||||||
<MembersAmount theme={theme}>
|
<ChannelDescription theme={theme}>
|
||||||
{" "}
|
{" "}
|
||||||
{channel.membersList.length} members
|
{channel.description}
|
||||||
</MembersAmount>
|
</ChannelDescription>
|
||||||
)}
|
)}
|
||||||
</ChannelTextInfo>
|
</ChannelTextInfo>
|
||||||
</ChannelInfo>
|
</ChannelInfo>
|
||||||
|
@ -153,7 +153,7 @@ const StyledCommunity = styled(Community)`
|
||||||
margin: 0 0 16px;
|
margin: 0 0 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const MembersAmount = styled.p<ThemeProps>`
|
const ChannelDescription = styled.p<ThemeProps>`
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
letter-spacing: 0.1px;
|
letter-spacing: 0.1px;
|
||||||
|
@ -199,6 +199,7 @@ const ChannelLogo = styled.div<ThemeProps>`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -66,7 +66,7 @@ export function Chat({ theme, community }: ChatProps) {
|
||||||
{showMembers && !narrow && (
|
{showMembers && !narrow && (
|
||||||
<Members
|
<Members
|
||||||
theme={theme}
|
theme={theme}
|
||||||
channel={activeChannel}
|
community={community}
|
||||||
setShowChannels={setShowChannels}
|
setShowChannels={setShowChannels}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -23,10 +23,10 @@ export const CommunityIdentity = ({
|
||||||
return (
|
return (
|
||||||
<Row className={className}>
|
<Row className={className}>
|
||||||
<Logo src={icon} alt={`${name} logo`} />
|
<Logo src={icon} alt={`${name} logo`} />
|
||||||
<div>
|
<Column>
|
||||||
<Name theme={theme}>{name}</Name>
|
<Name theme={theme}>{name}</Name>
|
||||||
<Subtitle theme={theme}>{subtitle}</Subtitle>
|
<Subtitle theme={theme}>{subtitle}</Subtitle>
|
||||||
</div>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,12 @@ const Row = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const Column = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
`;
|
||||||
|
|
||||||
const Logo = styled.img`
|
const Logo = styled.img`
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
|
@ -51,6 +57,7 @@ const Name = styled.p`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Subtitle = styled.p`
|
const Subtitle = styled.p`
|
||||||
|
font-family: "Inter", sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
letter-spacing: 0.1px;
|
letter-spacing: 0.1px;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { ChannelData } from "../helpers/channelsMock";
|
import { CommunityData } from "../helpers/communityMock";
|
||||||
import { Theme } from "../styles/themes";
|
import { Theme } from "../styles/themes";
|
||||||
|
|
||||||
import { Icon } from "./Chat/ChatMessages";
|
import { Icon } from "./Chat/ChatMessages";
|
||||||
|
@ -9,11 +9,11 @@ import { UserIcon } from "./Icons/UserIcon";
|
||||||
|
|
||||||
interface MembersProps {
|
interface MembersProps {
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
channel: ChannelData;
|
community: CommunityData;
|
||||||
setShowChannels: (val: boolean) => void;
|
setShowChannels: (val: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Members({ theme, channel, setShowChannels }: MembersProps) {
|
export function Members({ theme, community, setShowChannels }: MembersProps) {
|
||||||
return (
|
return (
|
||||||
<MembersWrapper theme={theme}>
|
<MembersWrapper theme={theme}>
|
||||||
<MemberHeading theme={theme}>Members</MemberHeading>
|
<MemberHeading theme={theme}>Members</MemberHeading>
|
||||||
|
@ -29,7 +29,7 @@ export function Members({ theme, channel, setShowChannels }: MembersProps) {
|
||||||
</MemberCategory>
|
</MemberCategory>
|
||||||
<MemberCategory>
|
<MemberCategory>
|
||||||
<MemberCategoryName theme={theme}>Online</MemberCategoryName>
|
<MemberCategoryName theme={theme}>Online</MemberCategoryName>
|
||||||
{channel.membersList
|
{community.membersList
|
||||||
.filter((member) => member.isOnline)
|
.filter((member) => member.isOnline)
|
||||||
.map((member) => (
|
.map((member) => (
|
||||||
<Member
|
<Member
|
||||||
|
@ -43,7 +43,7 @@ export function Members({ theme, channel, setShowChannels }: MembersProps) {
|
||||||
</MemberCategory>
|
</MemberCategory>
|
||||||
<MemberCategory>
|
<MemberCategory>
|
||||||
<MemberCategoryName theme={theme}>Offline</MemberCategoryName>
|
<MemberCategoryName theme={theme}>Offline</MemberCategoryName>
|
||||||
{channel.membersList
|
{community.membersList
|
||||||
.filter((member) => !member.isOnline)
|
.filter((member) => !member.isOnline)
|
||||||
.map((member) => (
|
.map((member) => (
|
||||||
<Member
|
<Member
|
||||||
|
|
|
@ -1,130 +1,34 @@
|
||||||
export type ChannelData = {
|
export type ChannelData = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
description: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
notifications?: number;
|
notifications?: number;
|
||||||
isMuted?: boolean;
|
isMuted?: boolean;
|
||||||
membersList: any[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const channels = [
|
export const channels = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "welcome",
|
name: "welcome",
|
||||||
|
description: "Welcome to CryptoKitties community!",
|
||||||
icon: "https://www.cryptokitties.co/icons/logo.svg",
|
icon: "https://www.cryptokitties.co/icons/logo.svg",
|
||||||
membersList: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "jason.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1613329150701-f8cecb3900e0?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=928&q=80",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "viola.stateofus.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1603924885283-b6674696b114?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80",
|
|
||||||
isOnline: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "GuestFest",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: "Guest33334",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: "Guest333",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
name: "Guest33",
|
|
||||||
isOnline: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 7,
|
|
||||||
name: "Guest9283",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "general",
|
name: "general",
|
||||||
membersList: [
|
description: "General discussions about CryptoKitties",
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "jason.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1613329150701-f8cecb3900e0?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=928&q=80",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "viola.stateofus.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1603924885283-b6674696b114?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80",
|
|
||||||
isOnline: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "Guest",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "beginners",
|
name: "beginners",
|
||||||
|
description: "How to start",
|
||||||
notifications: 1,
|
notifications: 1,
|
||||||
membersList: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "jason.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1613329150701-f8cecb3900e0?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=928&q=80",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "viola.stateofus.eth",
|
|
||||||
avatar:
|
|
||||||
"https://images.unsplash.com/photo-1603924885283-b6674696b114?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80",
|
|
||||||
isOnline: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "Merry Silvester Christmas",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
name: "random",
|
name: "random",
|
||||||
|
description: "Whatever you want to talk",
|
||||||
isMuted: true,
|
isMuted: true,
|
||||||
membersList: [
|
|
||||||
{
|
|
||||||
id: 14,
|
|
||||||
name: "jason",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 16,
|
|
||||||
name: "jonh",
|
|
||||||
isOnline: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "Guest",
|
|
||||||
isOnline: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,6 +3,7 @@ export type CommunityData = {
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
members: number;
|
members: number;
|
||||||
|
membersList: any[];
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,5 +12,46 @@ export const community = {
|
||||||
name: "CryptoKitties",
|
name: "CryptoKitties",
|
||||||
icon: "https://www.cryptokitties.co/icons/logo.svg",
|
icon: "https://www.cryptokitties.co/icons/logo.svg",
|
||||||
members: 186,
|
members: 186,
|
||||||
|
membersList: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "jason.eth",
|
||||||
|
avatar:
|
||||||
|
"https://images.unsplash.com/photo-1613329150701-f8cecb3900e0?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=928&q=80",
|
||||||
|
isOnline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "viola.stateofus.eth",
|
||||||
|
avatar:
|
||||||
|
"https://images.unsplash.com/photo-1603924885283-b6674696b114?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80",
|
||||||
|
isOnline: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "GuestFest",
|
||||||
|
isOnline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "Guest33334",
|
||||||
|
isOnline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: "Guest333",
|
||||||
|
isOnline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
name: "Guest33",
|
||||||
|
isOnline: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: "Guest9283",
|
||||||
|
isOnline: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
description: "A community of cat lovers, meow!",
|
description: "A community of cat lovers, meow!",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue