Community skeleton (#87)

This commit is contained in:
Maria Rushkova 2021-10-20 15:28:57 +02:00 committed by GitHub
parent 2b2a82828d
commit 863a89586e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 13 deletions

View File

@ -13,6 +13,7 @@ import { ChatBody } from "./Chat/ChatBody";
import { Community } from "./Community"; import { Community } from "./Community";
import { Members } from "./Members/Members"; import { Members } from "./Members/Members";
import { CommunityModal } from "./Modals/CommunityModal"; import { CommunityModal } from "./Modals/CommunityModal";
import { CommunitySkeleton } from "./Skeleton/CommunitySkeleton";
interface ChatProps { interface ChatProps {
theme: Theme; theme: Theme;
@ -92,7 +93,11 @@ export function Chat({ theme, communityKey, fetchMetadata }: ChatProps) {
<ChatWrapper> <ChatWrapper>
{showChannels && !narrow && ( {showChannels && !narrow && (
<ChannelsWrapper> <ChannelsWrapper>
{messenger ? (
<StyledCommunity onClick={showModal} community={communityData} /> <StyledCommunity onClick={showModal} community={communityData} />
) : (
<CommunitySkeleton />
)}
<Channels <Channels
notifications={notifications} notifications={notifications}
clearNotifications={clearNotifications} clearNotifications={clearNotifications}

View File

@ -13,6 +13,7 @@ import { Community } from "../Community";
import { MembersIcon } from "../Icons/MembersIcon"; import { MembersIcon } from "../Icons/MembersIcon";
import { NarrowChannels } from "../NarrowMode/NarrowChannels"; import { NarrowChannels } from "../NarrowMode/NarrowChannels";
import { NarrowMembers } from "../NarrowMode/NarrowMembers"; import { NarrowMembers } from "../NarrowMode/NarrowMembers";
import { CommunitySkeleton } from "../Skeleton/CommunitySkeleton";
import { Loading } from "../Skeleton/Loading"; import { Loading } from "../Skeleton/Loading";
import { LoadingSkeleton } from "../Skeleton/LoadingSkeleton"; import { LoadingSkeleton } from "../Skeleton/LoadingSkeleton";
@ -90,6 +91,8 @@ export function ChatBody({
} }
> >
<ChannelWrapper className={className}> <ChannelWrapper className={className}>
{messenger ? (
<>
{(showCommunity || narrow) && ( {(showCommunity || narrow) && (
<CommunityWrap className={className}> <CommunityWrap className={className}>
<Community onClick={onCommunityClick} community={community} /> <Community onClick={onCommunityClick} community={community} />
@ -102,7 +105,12 @@ export function ChatBody({
isMuted={false} isMuted={false}
onClick={() => (narrow ? switchChannelList() : undefined)} onClick={() => (narrow ? switchChannelList() : undefined)}
/> />
</>
) : (
<CommunitySkeleton />
)}
</ChannelWrapper> </ChannelWrapper>
<MemberBtn <MemberBtn
onClick={narrow ? () => switchMemberList() : onClick} onClick={narrow ? () => switchMemberList() : onClick}
className={ className={

View File

@ -31,7 +31,7 @@ const Row = styled.div`
display: flex; display: flex;
`; `;
const Column = styled.div` export const Column = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;

View File

@ -0,0 +1,29 @@
import React from "react";
import styled from "styled-components";
import { Column } from "../CommunityIdentity";
import { Skeleton } from "./Skeleton";
export const CommunitySkeleton = () => {
return (
<Loading>
<LogoSkeleton width="40px" height="40px" borderRadius="50%" />
<Column>
<Skeleton width="140px" height="16px" />
<Skeleton width="65px" height="16px" />
</Column>
</Loading>
);
};
const LogoSkeleton = styled(Skeleton)`
border-radius: 50%;
margin-right: 8px;
`;
const Loading = styled.div`
display: flex;
padding: 0 0 0 10px;
margin: 0 0 16px;
`;