Community skeleton (#87)
This commit is contained in:
parent
2b2a82828d
commit
863a89586e
|
@ -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>
|
||||||
<StyledCommunity onClick={showModal} community={communityData} />
|
{messenger ? (
|
||||||
|
<StyledCommunity onClick={showModal} community={communityData} />
|
||||||
|
) : (
|
||||||
|
<CommunitySkeleton />
|
||||||
|
)}
|
||||||
<Channels
|
<Channels
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
clearNotifications={clearNotifications}
|
clearNotifications={clearNotifications}
|
||||||
|
|
|
@ -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,19 +91,26 @@ export function ChatBody({
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ChannelWrapper className={className}>
|
<ChannelWrapper className={className}>
|
||||||
{(showCommunity || narrow) && (
|
{messenger ? (
|
||||||
<CommunityWrap className={className}>
|
<>
|
||||||
<Community onClick={onCommunityClick} community={community} />
|
{(showCommunity || narrow) && (
|
||||||
</CommunityWrap>
|
<CommunityWrap className={className}>
|
||||||
|
<Community onClick={onCommunityClick} community={community} />
|
||||||
|
</CommunityWrap>
|
||||||
|
)}
|
||||||
|
<Channel
|
||||||
|
channel={channel}
|
||||||
|
isActive={narrow ? showChannelsList : true}
|
||||||
|
activeView={true}
|
||||||
|
isMuted={false}
|
||||||
|
onClick={() => (narrow ? switchChannelList() : undefined)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<CommunitySkeleton />
|
||||||
)}
|
)}
|
||||||
<Channel
|
|
||||||
channel={channel}
|
|
||||||
isActive={narrow ? showChannelsList : true}
|
|
||||||
activeView={true}
|
|
||||||
isMuted={false}
|
|
||||||
onClick={() => (narrow ? switchChannelList() : undefined)}
|
|
||||||
/>
|
|
||||||
</ChannelWrapper>
|
</ChannelWrapper>
|
||||||
|
|
||||||
<MemberBtn
|
<MemberBtn
|
||||||
onClick={narrow ? () => switchMemberList() : onClick}
|
onClick={narrow ? () => switchMemberList() : onClick}
|
||||||
className={
|
className={
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
`;
|
Loading…
Reference in New Issue