From 5ffd8a537dbb2498b51dd0d2abf594a19c2e01fc Mon Sep 17 00:00:00 2001 From: Maria Rushkova <66270386+mrushkova@users.noreply.github.com> Date: Fri, 8 Oct 2021 10:16:49 +0200 Subject: [PATCH] Add theme Provider (#53) --- .../src/components/Buttons/DownloadButton.tsx | 6 +- .../react-chat/src/components/Channels.tsx | 41 ++++--------- packages/react-chat/src/components/Chat.tsx | 8 +-- .../src/components/Chat/ChatBody.tsx | 41 +++++-------- .../src/components/Chat/ChatInput.tsx | 20 +++--- .../components/Chat/ChatMessageContent.tsx | 11 +--- .../src/components/Chat/ChatMessages.tsx | 29 +++------ .../react-chat/src/components/Community.tsx | 10 +-- .../src/components/CommunityIdentity.tsx | 8 +-- .../src/components/EmptyChannel.tsx | 17 ++---- .../src/components/Form/CopyInput.tsx | 16 ++--- .../src/components/Icons/CrossIcon.tsx | 5 +- .../src/components/Icons/EmojiIcon.tsx | 8 +-- .../src/components/Icons/GifIcon.tsx | 8 +-- .../src/components/Icons/LoadingIcon.tsx | 5 +- .../src/components/Icons/MembersIcon.tsx | 11 +--- .../src/components/Icons/MutedIcon.tsx | 11 +--- .../src/components/Icons/PictureIcon.tsx | 11 +--- .../src/components/Icons/StatusLogo.tsx | 5 +- .../src/components/Icons/StickerIcon.tsx | 8 +-- .../src/components/Icons/UserIcon.tsx | 6 +- .../react-chat/src/components/Members.tsx | 49 +++++---------- .../src/components/Modals/CommunityModal.tsx | 34 ++++------- .../src/components/Modals/Modal.tsx | 9 +-- .../components/NarrowMode/NarrowChannels.tsx | 14 +---- .../components/NarrowMode/NarrowMembers.tsx | 18 +----- .../components/NarrowMode/NarrowTopbar.tsx | 21 +++---- .../react-chat/src/components/ReactChat.tsx | 23 ++++--- .../src/components/Skeleton/Loading.tsx | 15 ++--- .../components/Skeleton/LoadingSkeleton.tsx | 61 ++++++++----------- .../components/Skeleton/MessageSkeleton.tsx | 16 ++--- .../src/components/Skeleton/Skeleton.tsx | 3 - 32 files changed, 163 insertions(+), 385 deletions(-) diff --git a/packages/react-chat/src/components/Buttons/DownloadButton.tsx b/packages/react-chat/src/components/Buttons/DownloadButton.tsx index c1d3e9b..78f8d51 100644 --- a/packages/react-chat/src/components/Buttons/DownloadButton.tsx +++ b/packages/react-chat/src/components/Buttons/DownloadButton.tsx @@ -1,8 +1,6 @@ import React, { useEffect, useState } from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - const userAgent = window.navigator.userAgent; const platform = window.navigator.platform; const macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"]; @@ -10,11 +8,10 @@ const windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"]; const iosPlatforms = ["iPhone", "iPad", "iPod"]; interface DownloadButtonProps { - theme: Theme; className?: string; } -export const DownloadButton = ({ theme, className }: DownloadButtonProps) => { +export const DownloadButton = ({ className }: DownloadButtonProps) => { const [link, setlink] = useState("https://status.im/get/"); const [os, setOs] = useState(null); @@ -51,7 +48,6 @@ export const DownloadButton = ({ theme, className }: DownloadButtonProps) => { diff --git a/packages/react-chat/src/components/Channels.tsx b/packages/react-chat/src/components/Channels.tsx index 4f42ea4..6be9af2 100644 --- a/packages/react-chat/src/components/Channels.tsx +++ b/packages/react-chat/src/components/Channels.tsx @@ -4,14 +4,12 @@ import styled from "styled-components"; import { useNarrow } from "../contexts/narrowProvider"; import { ChannelData, channels } from "../helpers/channelsMock"; import { CommunityData } from "../helpers/communityMock"; -import { Theme } from "../styles/themes"; import { Community } from "./Community"; import { MutedIcon } from "./Icons/MutedIcon"; import { textMediumStyles } from "./Text"; interface ChannelsProps { - theme: Theme; community: CommunityData; notifications: { [id: string]: number }; clearNotifications: (id: string) => void; @@ -21,7 +19,6 @@ interface ChannelsProps { } export function Channels({ - theme, community, notifications, setActiveChannel, @@ -39,18 +36,13 @@ export function Channels({ }, [notifications, activeChannelId]); return ( - - + + {channels.map((channel) => ( @@ -108,13 +97,11 @@ export function Channel({ backgroundImage: channel.icon ? `url(${channel.icon}` : "", }} className={className} - theme={theme} > {!channel.icon && channel.name.slice(0, 1).toUpperCase()} {activeView && ( - - {" "} - {channel.description} - + {channel.description} )} {notification && notification > 0 && !activeView && ( - {notification} + {notification} )} - {isMuted && !notification && } + {isMuted && !notification && } ); } -interface ThemeProps { - theme: Theme; -} -const ChannelsWrapper = styled.div` +const ChannelsWrapper = styled.div` width: 21%; height: 100%; min-width: 196px; @@ -161,7 +142,7 @@ const StyledCommunity = styled(Community)` margin: 0 0 16px; `; -const ChannelDescription = styled.p` +const ChannelDescription = styled.p` font-size: 12px; line-height: 16px; letter-spacing: 0.1px; @@ -181,7 +162,7 @@ export const ChannelList = styled.div` } `; -const ChannelWrapper = styled.div` +const ChannelWrapper = styled.div` display: flex; justify-content: space-between; align-items: center; @@ -207,7 +188,7 @@ const ChannelTextInfo = styled.div` overflow: hidden; `; -export const ChannelLogo = styled.div` +export const ChannelLogo = styled.div` width: 24px; height: 24px; display: flex; @@ -239,7 +220,7 @@ export const ChannelLogo = styled.div` } `; -export const ChannelName = styled.p` +export const ChannelName = styled.p` font-weight: 500; opacity: 0.7; color: ${({ theme }) => theme.primary}; @@ -259,7 +240,7 @@ export const ChannelName = styled.p` } `; -const NotificationBagde = styled.div` +const NotificationBagde = styled.div` width: 24px; height: 24px; border-radius: 50%; diff --git a/packages/react-chat/src/components/Chat.tsx b/packages/react-chat/src/components/Chat.tsx index 0ef78a1..eae7cc7 100644 --- a/packages/react-chat/src/components/Chat.tsx +++ b/packages/react-chat/src/components/Chat.tsx @@ -47,7 +47,6 @@ export function Chat({ theme, community, fetchMetadata }: ChatProps) { {showMembers && !narrow && ( - + )} setIsModalVisible(false)} icon={community.icon} name={community.name} - theme={theme} subtitle="Public Community" description={community.description} publicKey="0xD95DBdaB08A9FED2D71ac9C3028AAc40905d8CF3" diff --git a/packages/react-chat/src/components/Chat/ChatBody.tsx b/packages/react-chat/src/components/Chat/ChatBody.tsx index 229c27c..9e354c1 100644 --- a/packages/react-chat/src/components/Chat/ChatBody.tsx +++ b/packages/react-chat/src/components/Chat/ChatBody.tsx @@ -72,26 +72,20 @@ export function ChatBody({ }, [showMembersList]); return ( - + {(showCommunity || narrow) && ( - - + + )} - + - {!messenger && } + {!messenger && } {messenger ? ( <> @@ -122,22 +115,20 @@ export function ChatBody({ messenger ? ( ) : ( - + ) ) : ( - + )} - + )} {showChannelsList && narrow && ( ) : ( <> - - + + )} ); } -interface ThemeProps { - theme: Theme; -} -const ChatBodyWrapper = styled.div` +const ChatBodyWrapper = styled.div` display: flex; flex-direction: column; flex: 1; @@ -188,7 +175,7 @@ const ChannelWrapper = styled.div` } `; -const ChatTopbar = styled.div` +const ChatTopbar = styled.div` display: flex; justify-content: space-between; padding: 5px 8px; @@ -204,7 +191,7 @@ const ChatTopbar = styled.div` } `; -const CommunityWrap = styled.div` +const CommunityWrap = styled.div` padding-right: 10px; margin-right: 16px; position: relative; @@ -227,7 +214,7 @@ const CommunityWrap = styled.div` } `; -const MemberBtn = styled.button` +const MemberBtn = styled.button` width: 32px; height: 32px; border-radius: 8px; diff --git a/packages/react-chat/src/components/Chat/ChatInput.tsx b/packages/react-chat/src/components/Chat/ChatInput.tsx index abe0250..3b3a8a6 100644 --- a/packages/react-chat/src/components/Chat/ChatInput.tsx +++ b/packages/react-chat/src/components/Chat/ChatInput.tsx @@ -42,7 +42,7 @@ export function ChatInput({ theme, addMessage }: ChatInputProps) { - + {image && ( setImageUint(undefined)} /> )} ) => { @@ -107,22 +105,18 @@ export function ChatInput({ theme, addMessage }: ChatInputProps) { /> setShowEmoji(!showEmoji)}> - + - + - + ); } -interface ThemeProps { - theme: Theme; -} - const InputWrapper = styled.div` display: flex; align-items: center; @@ -138,7 +132,7 @@ const ImagePreview = styled.img` margin-top: 9px; `; -const InputImageWrapper = styled.div` +const InputImageWrapper = styled.div` width: 100%; display: flex; flex-direction: column; @@ -149,7 +143,7 @@ const InputImageWrapper = styled.div` margin-left: 10px; `; -const Input = styled.textarea` +const Input = styled.textarea` width: 100%; height: 40px; background: ${({ theme }) => theme.inputColor}; diff --git a/packages/react-chat/src/components/Chat/ChatMessageContent.tsx b/packages/react-chat/src/components/Chat/ChatMessageContent.tsx index c248139..da21f32 100644 --- a/packages/react-chat/src/components/Chat/ChatMessageContent.tsx +++ b/packages/react-chat/src/components/Chat/ChatMessageContent.tsx @@ -4,7 +4,6 @@ import styled from "styled-components"; import { ChatMessage } from "../../models/ChatMessage"; import { Metadata } from "../../models/Metadata"; -import { Theme } from "../../styles/themes"; /* eslint-disable no-useless-escape */ const regEx = @@ -13,13 +12,11 @@ const regEx = type ChatMessageContentProps = { message: ChatMessage; - theme: Theme; fetchMetadata?: (url: string) => Promise; }; export function ChatMessageContent({ message, - theme, fetchMetadata, }: ChatMessageContentProps) { const { content, image } = useMemo(() => message, [message]); @@ -40,13 +37,7 @@ export function ChatMessageContent({ ? match : "https://" + match; newSplit.push( - + {match} , split[idx + 1] diff --git a/packages/react-chat/src/components/Chat/ChatMessages.tsx b/packages/react-chat/src/components/Chat/ChatMessages.tsx index d65f44b..f98daff 100644 --- a/packages/react-chat/src/components/Chat/ChatMessages.tsx +++ b/packages/react-chat/src/components/Chat/ChatMessages.tsx @@ -3,7 +3,6 @@ import styled from "styled-components"; import { ChatMessage } from "../../models/ChatMessage"; import { Metadata } from "../../models/Metadata"; -import { Theme } from "../../styles/themes"; import { UserIcon } from "../Icons/UserIcon"; import { textSmallStyles } from "../Text"; @@ -11,15 +10,10 @@ import { ChatMessageContent } from "./ChatMessageContent"; type ChatMessagesProps = { messages: ChatMessage[]; - theme: Theme; fetchMetadata?: (url: string) => Promise; }; -export function ChatMessages({ - messages, - theme, - fetchMetadata, -}: ChatMessagesProps) { +export function ChatMessages({ messages, fetchMetadata }: ChatMessagesProps) { const [scrollOnBot, setScrollOnBot] = useState(false); const ref = useRef(null); const today = useMemo(() => new Date().getDay(), []); @@ -64,22 +58,19 @@ export function ChatMessages({ )} - + - + {message.sender.slice(0, 10)} - - {message.date.toLocaleString()} - + {message.date.toLocaleString()} - + @@ -92,10 +83,6 @@ export function ChatMessages({ ); } -interface ThemeProps { - theme: Theme; -} - const MessagesWrapper = styled.div` height: calc(100% - 44px); overflow: auto; @@ -159,13 +146,13 @@ export const Icon = styled.div` flex-shrink: 0; `; -const UserNameWrapper = styled.div` +const UserNameWrapper = styled.div` font-size: 15px; line-height: 22px; color: ${({ theme }) => theme.tertiary}; `; -const TimeWrapper = styled.div` +const TimeWrapper = styled.div` font-size: 10px; line-height: 14px; letter-spacing: 0.2px; @@ -174,7 +161,7 @@ const TimeWrapper = styled.div` margin-left: 4px; `; -const MessageText = styled.div` +const MessageText = styled.div` overflow-wrap: anywhere; width: 100%; white-space: pre-wrap; diff --git a/packages/react-chat/src/components/Community.tsx b/packages/react-chat/src/components/Community.tsx index 4b24a18..fb9e28e 100644 --- a/packages/react-chat/src/components/Community.tsx +++ b/packages/react-chat/src/components/Community.tsx @@ -1,23 +1,16 @@ import React from "react"; import { CommunityData } from "../helpers/communityMock"; -import { Theme } from "../styles/themes"; import { CommunityIdentity } from "./CommunityIdentity"; interface CommunityProps { - theme: Theme; community: CommunityData; onClick: () => void; className?: string; } -export function Community({ - theme, - community, - onClick, - className, -}: CommunityProps) { +export function Community({ community, onClick, className }: CommunityProps) { const { name, icon, members } = community; return ( @@ -27,7 +20,6 @@ export function Community({ name={name} icon={icon} subtitle={`${members} members`} - theme={theme} /> diff --git a/packages/react-chat/src/components/CommunityIdentity.tsx b/packages/react-chat/src/components/CommunityIdentity.tsx index fb76f25..4848b73 100644 --- a/packages/react-chat/src/components/CommunityIdentity.tsx +++ b/packages/react-chat/src/components/CommunityIdentity.tsx @@ -1,15 +1,12 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../styles/themes"; - import { textMediumStyles } from "./Text"; export interface CommunityIdentityProps { icon: string; name: string; subtitle: string; - theme: Theme; className?: string; } @@ -18,14 +15,13 @@ export const CommunityIdentity = ({ name, subtitle, className, - theme, }: CommunityIdentityProps) => { return ( - {name} - {subtitle} + {name} + {subtitle} ); diff --git a/packages/react-chat/src/components/EmptyChannel.tsx b/packages/react-chat/src/components/EmptyChannel.tsx index 892ea05..30faba5 100644 --- a/packages/react-chat/src/components/EmptyChannel.tsx +++ b/packages/react-chat/src/components/EmptyChannel.tsx @@ -2,17 +2,15 @@ import React from "react"; import styled from "styled-components"; import { ChannelData } from "../helpers/channelsMock"; -import { Theme } from "../styles/themes"; import { ChannelInfo, ChannelLogo, ChannelName } from "./Channels"; import { textMediumStyles } from "./Text"; type EmptyChannelProps = { - theme: Theme; channel: ChannelData; }; -export function EmptyChannel({ theme, channel }: EmptyChannelProps) { +export function EmptyChannel({ channel }: EmptyChannelProps) { return ( @@ -20,26 +18,19 @@ export function EmptyChannel({ theme, channel }: EmptyChannelProps) { style={{ backgroundImage: channel.icon ? `url(${channel.icon}` : "", }} - theme={theme} > {" "} {!channel.icon && channel.name.slice(0, 1).toUpperCase()} - - {channel.name} - + {channel.name} - + Welcome to the beginning of the #{channel.name} channel! ); } -interface ThemeProps { - theme: Theme; -} - const Wrapper = styled.div` display: flex; flex-direction: column; @@ -68,7 +59,7 @@ const ChannelNameEmpty = styled(ChannelName)` margin-bottom: 16px; `; -const EmptyText = styled.p` +const EmptyText = styled.p` display: inline-block; color: ${({ theme }) => theme.secondary}; diff --git a/packages/react-chat/src/components/Form/CopyInput.tsx b/packages/react-chat/src/components/Form/CopyInput.tsx index 1c5952d..e600a19 100644 --- a/packages/react-chat/src/components/Form/CopyInput.tsx +++ b/packages/react-chat/src/components/Form/CopyInput.tsx @@ -1,7 +1,6 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; import { copy } from "../../utils/copy"; import { reduceString } from "../../utils/reduceString"; import { textMediumStyles, textSmallStyles } from "../Text"; @@ -9,18 +8,15 @@ import { textMediumStyles, textSmallStyles } from "../Text"; interface CopyInputProps { label: string; value: string; - theme: Theme; } -export const CopyInput = ({ label, value, theme }: CopyInputProps) => ( +export const CopyInput = ({ label, value }: CopyInputProps) => (
- - - {reduceString(value, 15, 15)} - - copy(value)}> - Copy - + + + {reduceString(value, 15, 15)} + + copy(value)}>Copy
diff --git a/packages/react-chat/src/components/Icons/CrossIcon.tsx b/packages/react-chat/src/components/Icons/CrossIcon.tsx index 575e766..372ace1 100644 --- a/packages/react-chat/src/components/Icons/CrossIcon.tsx +++ b/packages/react-chat/src/components/Icons/CrossIcon.tsx @@ -1,11 +1,8 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - -export const CrossIcon = ({ theme }: { theme: Theme }) => ( +export const CrossIcon = () => ( { +export const EmojiIcon = ({ isActive }: ThemeProps) => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.secondary}; } diff --git a/packages/react-chat/src/components/Icons/GifIcon.tsx b/packages/react-chat/src/components/Icons/GifIcon.tsx index e202da4..1321e04 100644 --- a/packages/react-chat/src/components/Icons/GifIcon.tsx +++ b/packages/react-chat/src/components/Icons/GifIcon.tsx @@ -1,21 +1,17 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - interface ThemeProps { - theme: Theme; isActive?: boolean; } -export const GifIcon = ({ theme, isActive }: ThemeProps) => { +export const GifIcon = ({ isActive }: ThemeProps) => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.secondary}; } diff --git a/packages/react-chat/src/components/Icons/LoadingIcon.tsx b/packages/react-chat/src/components/Icons/LoadingIcon.tsx index aab25b0..64b8c6d 100644 --- a/packages/react-chat/src/components/Icons/LoadingIcon.tsx +++ b/packages/react-chat/src/components/Icons/LoadingIcon.tsx @@ -1,8 +1,6 @@ import React from "react"; import styled, { keyframes } from "styled-components"; -import { Theme } from "../../styles/themes"; - const rotation = keyframes` from { transform: rotate(0deg); @@ -12,13 +10,12 @@ const rotation = keyframes` } `; -export const LoadingIcon = ({ theme }: { theme: Theme }) => ( +export const LoadingIcon = () => ( { +export const MembersIcon = () => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.primary}; } diff --git a/packages/react-chat/src/components/Icons/MutedIcon.tsx b/packages/react-chat/src/components/Icons/MutedIcon.tsx index 1bcd14f..ec476ce 100644 --- a/packages/react-chat/src/components/Icons/MutedIcon.tsx +++ b/packages/react-chat/src/components/Icons/MutedIcon.tsx @@ -1,20 +1,13 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - -interface ThemeProps { - theme: Theme; -} - -export const MutedIcon = ({ theme }: ThemeProps) => { +export const MutedIcon = () => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.primary}; } diff --git a/packages/react-chat/src/components/Icons/PictureIcon.tsx b/packages/react-chat/src/components/Icons/PictureIcon.tsx index 6ec821a..5eeb387 100644 --- a/packages/react-chat/src/components/Icons/PictureIcon.tsx +++ b/packages/react-chat/src/components/Icons/PictureIcon.tsx @@ -1,20 +1,13 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - -interface ThemeProps { - theme: Theme; -} - -export const PictureIcon = ({ theme }: ThemeProps) => { +export const PictureIcon = () => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.secondary}; } diff --git a/packages/react-chat/src/components/Icons/StatusLogo.tsx b/packages/react-chat/src/components/Icons/StatusLogo.tsx index 94666b7..ad15231 100644 --- a/packages/react-chat/src/components/Icons/StatusLogo.tsx +++ b/packages/react-chat/src/components/Icons/StatusLogo.tsx @@ -1,11 +1,8 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - -export const StatusLogo = ({ theme }: { theme: Theme }) => ( +export const StatusLogo = () => ( { +export const StickerIcon = ({ isActive }: ThemeProps) => { return ( { ); }; -const Icon = styled.svg` +const Icon = styled.svg` & > path { fill: ${({ theme }) => theme.secondary}; } diff --git a/packages/react-chat/src/components/Icons/UserIcon.tsx b/packages/react-chat/src/components/Icons/UserIcon.tsx index d945370..cab5304 100644 --- a/packages/react-chat/src/components/Icons/UserIcon.tsx +++ b/packages/react-chat/src/components/Icons/UserIcon.tsx @@ -1,20 +1,16 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - interface UserIconProps { - theme: Theme; memberView?: boolean; } -export const UserIcon = ({ theme, memberView }: UserIconProps) => { +export const UserIcon = ({ memberView }: UserIconProps) => { return ( diff --git a/packages/react-chat/src/components/Members.tsx b/packages/react-chat/src/components/Members.tsx index 9d0f998..94fcaa1 100644 --- a/packages/react-chat/src/components/Members.tsx +++ b/packages/react-chat/src/components/Members.tsx @@ -3,39 +3,31 @@ import styled from "styled-components"; import { useNarrow } from "../contexts/narrowProvider"; import { CommunityData } from "../helpers/communityMock"; -import { Theme } from "../styles/themes"; import { Icon } from "./Chat/ChatMessages"; import { UserIcon } from "./Icons/UserIcon"; interface MembersProps { - theme: Theme; community: CommunityData; setShowChannels: (val: boolean) => void; } -export function Members({ theme, community, setShowChannels }: MembersProps) { +export function Members({ community, setShowChannels }: MembersProps) { return ( - - Members - + + Members + ); } interface MembersListProps { - theme: Theme; community: CommunityData; setShowChannels: (val: boolean) => void; setShowMembers?: (val: boolean) => void; } export function MembersList({ - theme, community, setShowChannels, setShowMembers, @@ -43,22 +35,21 @@ export function MembersList({ return ( - You + You - + - Guest564732 + Guest564732 - Online + Online {community.membersList .filter((member) => member.isOnline) .map((member) => ( - Offline + Offline {community.membersList .filter((member) => !member.isOnline) .map((member) => ( void; @@ -94,7 +83,6 @@ interface MemberProps { } export function Member({ - theme, member, isOnline, setShowChannels, @@ -118,20 +106,15 @@ export function Member({ backgroundImage: member.avatar ? `url(${member.avatar})` : "unset", }} className={isOnline ? "online" : ""} - theme={theme} > - {!member.avatar && } + {!member.avatar && } - {member.name} + {member.name} ); } -interface ThemeProps { - theme: Theme; -} - -const MembersWrapper = styled.div` +const MembersWrapper = styled.div` width: 18%; height: 100%; min-width: 164px; @@ -141,7 +124,7 @@ const MembersWrapper = styled.div` padding: 16px; `; -const MemberHeading = styled.h2` +const MemberHeading = styled.h2` font-weight: 500; font-size: 15px; line-height: 22px; @@ -149,7 +132,7 @@ const MemberHeading = styled.h2` margin-bottom: 16px; `; -const MemberCategoryName = styled.h3` +const MemberCategoryName = styled.h3` font-weight: normal; font-size: 13px; line-height: 18px; @@ -157,7 +140,7 @@ const MemberCategoryName = styled.h3` margin-bottom: 8px; `; -const MemberName = styled.p` +const MemberName = styled.p` font-weight: 500; font-size: 15px; line-height: 22px; @@ -191,7 +174,7 @@ const MemberData = styled.div` margin-bottom: 16px; `; -const MemberIcon = styled(Icon)` +const MemberIcon = styled(Icon)` width: 24px; height: 24px; position: relative; diff --git a/packages/react-chat/src/components/Modals/CommunityModal.tsx b/packages/react-chat/src/components/Modals/CommunityModal.tsx index bde3bb1..a2c359b 100644 --- a/packages/react-chat/src/components/Modals/CommunityModal.tsx +++ b/packages/react-chat/src/components/Modals/CommunityModal.tsx @@ -26,39 +26,29 @@ export const CommunityModal = ({ subtitle, description, publicKey, - theme, }: CommunityModalProps) => { const narrow = useNarrow(); return ( - -
- + +
+
-
- {description} +
+ {description}
-
- - +
+ + To access this community, paste community public key in Status desktop or mobile app. - {narrow && } + {narrow && }
{!narrow && ( - - - + + + )} diff --git a/packages/react-chat/src/components/Modals/Modal.tsx b/packages/react-chat/src/components/Modals/Modal.tsx index a867395..ec10d6c 100644 --- a/packages/react-chat/src/components/Modals/Modal.tsx +++ b/packages/react-chat/src/components/Modals/Modal.tsx @@ -2,14 +2,12 @@ import React, { ReactNode, useCallback, useEffect } from "react"; import { createPortal } from "react-dom"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; import { CrossIcon } from "../Icons/CrossIcon"; export interface BasicModalProps { isVisible: boolean; onClose: () => void; className?: string; - theme: Theme; } export interface ModalProps extends BasicModalProps { @@ -21,7 +19,6 @@ export const Modal = ({ onClose, children, className, - theme, }: ModalProps) => { const listenKeyboard = useCallback( (event: KeyboardEvent) => { @@ -45,10 +42,10 @@ export const Modal = ({ return createPortal( - - + + - + {children} diff --git a/packages/react-chat/src/components/NarrowMode/NarrowChannels.tsx b/packages/react-chat/src/components/NarrowMode/NarrowChannels.tsx index a20900d..c7e5ac0 100644 --- a/packages/react-chat/src/components/NarrowMode/NarrowChannels.tsx +++ b/packages/react-chat/src/components/NarrowMode/NarrowChannels.tsx @@ -2,13 +2,11 @@ import React from "react"; import styled from "styled-components"; import { ChannelData, channels } from "../../helpers/channelsMock"; -import { Theme } from "../../styles/themes"; import { Channel, ChannelList } from "../Channels"; import { NarrowTopbar } from "./NarrowTopbar"; interface NarrowChannelsProps { - theme: Theme; community: string; notifications: { [id: string]: number }; setActiveChannel: (val: ChannelData) => void; @@ -17,7 +15,6 @@ interface NarrowChannelsProps { } export function NarrowChannels({ - theme, community, notifications, setActiveChannel, @@ -25,14 +22,13 @@ export function NarrowChannels({ setShowChannels, }: NarrowChannelsProps) { return ( - - + + {channels.map((channel) => ( ` +const ListWrapper = styled.div` padding: 82px 18px 18px; background: ${({ theme }) => theme.bodyBackgroundColor}; `; diff --git a/packages/react-chat/src/components/NarrowMode/NarrowMembers.tsx b/packages/react-chat/src/components/NarrowMode/NarrowMembers.tsx index bae322d..fb847d4 100644 --- a/packages/react-chat/src/components/NarrowMode/NarrowMembers.tsx +++ b/packages/react-chat/src/components/NarrowMode/NarrowMembers.tsx @@ -2,33 +2,25 @@ import React from "react"; import styled from "styled-components"; import { CommunityData } from "../../helpers/communityMock"; -import { Theme } from "../../styles/themes"; import { MembersList } from "../Members"; import { NarrowTopbar } from "./NarrowTopbar"; interface NarrowMembersProps { - theme: Theme; community: CommunityData; setShowChannels: (val: boolean) => void; setShowMembersList: (val: boolean) => void; } export function NarrowMembers({ - theme, community, setShowChannels, setShowMembersList, }: NarrowMembersProps) { return ( - - + + ` +const ListWrapper = styled.div` padding: 82px 18px 18px; background: ${({ theme }) => theme.bodyBackgroundColor}; `; diff --git a/packages/react-chat/src/components/NarrowMode/NarrowTopbar.tsx b/packages/react-chat/src/components/NarrowMode/NarrowTopbar.tsx index e537c88..367dbb8 100644 --- a/packages/react-chat/src/components/NarrowMode/NarrowTopbar.tsx +++ b/packages/react-chat/src/components/NarrowMode/NarrowTopbar.tsx @@ -1,28 +1,21 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - interface NarrowTopbarProps { - theme: Theme; list: string; community: string; } -export function NarrowTopbar({ theme, list, community }: NarrowTopbarProps) { +export function NarrowTopbar({ list, community }: NarrowTopbarProps) { return ( - - {list} - {community} + + {list} + {community} ); } -interface ThemeProps { - theme: Theme; -} - -const TopbarWrapper = styled.div` +const TopbarWrapper = styled.div` display: flex; justify-content: center; flex-direction: column; @@ -32,12 +25,12 @@ const TopbarWrapper = styled.div` position: relative; `; -const Heading = styled.p` +const Heading = styled.p` font-weight: 500; color: ${({ theme }) => theme.primary}; `; -const SubHeading = styled.p` +const SubHeading = styled.p` font-weight: 500; color: ${({ theme }) => theme.secondary}; `; diff --git a/packages/react-chat/src/components/ReactChat.tsx b/packages/react-chat/src/components/ReactChat.tsx index 14aa83f..7cc7ff8 100644 --- a/packages/react-chat/src/components/ReactChat.tsx +++ b/packages/react-chat/src/components/ReactChat.tsx @@ -1,4 +1,5 @@ import React, { useRef } from "react"; +import { ThemeProvider } from "styled-components"; import { NarrowProvider } from "../contexts/narrowProvider"; import { CommunityData } from "../helpers/communityMock"; @@ -17,15 +18,17 @@ interface ReactChatProps { export function ReactChat({ theme, community, fetchMetadata }: ReactChatProps) { const ref = useRef(null); return ( - -
- - -
-
+ + +
+ + +
+
+
); } diff --git a/packages/react-chat/src/components/Skeleton/Loading.tsx b/packages/react-chat/src/components/Skeleton/Loading.tsx index e1fde83..a742036 100644 --- a/packages/react-chat/src/components/Skeleton/Loading.tsx +++ b/packages/react-chat/src/components/Skeleton/Loading.tsx @@ -1,24 +1,19 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; import { LoadingIcon } from "../Icons/LoadingIcon"; import { textSmallStyles } from "../Text"; -interface LoadingProps { - theme: Theme; -} - -export const Loading = ({ theme }: LoadingProps) => { +export const Loading = () => { return ( - - + + Loading messages... ); }; -const LoadingBlock = styled.div` +const LoadingBlock = styled.div` display: flex; align-items: center; position: absolute; @@ -34,7 +29,7 @@ const LoadingBlock = styled.div` z-index: 2; `; -const LoadingText = styled.p` +const LoadingText = styled.p` color: ${({ theme }) => theme.primary}; margin-left: 8px; font-weight: 500; diff --git a/packages/react-chat/src/components/Skeleton/LoadingSkeleton.tsx b/packages/react-chat/src/components/Skeleton/LoadingSkeleton.tsx index 2ebdba8..7cade44 100644 --- a/packages/react-chat/src/components/Skeleton/LoadingSkeleton.tsx +++ b/packages/react-chat/src/components/Skeleton/LoadingSkeleton.tsx @@ -1,56 +1,45 @@ import React from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - import { MessageSkeleton } from "./MessageSkeleton"; import { Skeleton } from "./Skeleton"; -interface LoadingSkeletonProps { - theme: Theme; -} - -export const LoadingSkeleton = ({ theme }: LoadingSkeletonProps) => { +export const LoadingSkeleton = () => { return ( - - + + - - + + - - + + - - + + - - - + + + - - + + - - - - + + + + - - - + + + - - + + - - + + ); diff --git a/packages/react-chat/src/components/Skeleton/MessageSkeleton.tsx b/packages/react-chat/src/components/Skeleton/MessageSkeleton.tsx index ff67bd8..b960c85 100644 --- a/packages/react-chat/src/components/Skeleton/MessageSkeleton.tsx +++ b/packages/react-chat/src/components/Skeleton/MessageSkeleton.tsx @@ -1,28 +1,20 @@ import React, { ReactNode } from "react"; import styled from "styled-components"; -import { Theme } from "../../styles/themes"; - import { Skeleton } from "./Skeleton"; interface MessageSkeletonProps { - theme: Theme; children: ReactNode; } -export const MessageSkeleton = ({ theme, children }: MessageSkeletonProps) => { +export const MessageSkeleton = ({ children }: MessageSkeletonProps) => { return ( - + - - + + {children} diff --git a/packages/react-chat/src/components/Skeleton/Skeleton.tsx b/packages/react-chat/src/components/Skeleton/Skeleton.tsx index 7a36cc0..63da25a 100644 --- a/packages/react-chat/src/components/Skeleton/Skeleton.tsx +++ b/packages/react-chat/src/components/Skeleton/Skeleton.tsx @@ -1,9 +1,6 @@ import styled, { keyframes } from "styled-components"; -import { Theme } from "../../styles/themes"; - interface SkeletonProps { - theme: Theme; width?: string; height?: string; borderRadius?: string;