From 51c6250b6ed2a16b6a91b15eaf0a99184c247ec3 Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Thu, 14 Apr 2022 13:44:55 +0200 Subject: [PATCH] feat(react): improve usage of theme tokens --- .../components/channels/channel-group.tsx | 3 +- .../community-info/community-dialog.tsx | 4 +- .../components/community-info/index.tsx | 2 +- .../components/sidebar-item/index.tsx | 10 ++-- .../src/components/main-sidebar/index.tsx | 14 ++--- .../src/components/member-sidebar/index.tsx | 2 +- .../components/member-sidebar/member-item.tsx | 2 +- .../src/modules/community/index.tsx | 56 +++++++++---------- .../src/modules/community/messenger.tsx | 1 + .../chat/components/chat-message/index.tsx | 2 +- packages/status-react/src/routes/index.tsx | 1 + .../src/routes/new-chat/index.tsx | 1 - packages/status-react/src/styles/config.tsx | 7 +++ .../status-react/src/system/avatar/styles.tsx | 8 +-- .../status-react/src/system/dialog/styles.tsx | 8 +-- .../src/system/icon-button/styles.tsx | 18 +++--- 16 files changed, 71 insertions(+), 68 deletions(-) diff --git a/packages/status-react/src/components/main-sidebar/components/channels/channel-group.tsx b/packages/status-react/src/components/main-sidebar/components/channels/channel-group.tsx index 4168fb57..048077f1 100644 --- a/packages/status-react/src/components/main-sidebar/components/channels/channel-group.tsx +++ b/packages/status-react/src/components/main-sidebar/components/channels/channel-group.tsx @@ -48,9 +48,10 @@ const CollapsibleTrigger = styled(Collapsible.Trigger, { padding: 8, borderRadius: 8, height: 34, + color: '$accent-1', '&:hover': { - background: '#E9EDF1', + background: '$gray-3', }, '&[aria-expanded="true"] svg': { diff --git a/packages/status-react/src/components/main-sidebar/components/community-info/community-dialog.tsx b/packages/status-react/src/components/main-sidebar/components/community-info/community-dialog.tsx index e2875b90..4f6dc2e8 100644 --- a/packages/status-react/src/components/main-sidebar/components/community-info/community-dialog.tsx +++ b/packages/status-react/src/components/main-sidebar/components/community-info/community-dialog.tsx @@ -28,7 +28,7 @@ export const CommunityDialog = () => { justify="center" align="center" direction="column" - css={{ padding: '8px 0 16px' }} + css={{ padding: '8px 0 16px', color: '$accent-1' }} > { /> diff --git a/packages/status-react/src/components/main-sidebar/components/community-info/index.tsx b/packages/status-react/src/components/main-sidebar/components/community-info/index.tsx index 57f9b6b5..439d4ce7 100644 --- a/packages/status-react/src/components/main-sidebar/components/community-info/index.tsx +++ b/packages/status-react/src/components/main-sidebar/components/community-info/index.tsx @@ -34,6 +34,6 @@ const Button = styled('button', { alignItems: 'center', '&:hover': { - background: '#E9EDF1', + background: '$gray-3', }, }) diff --git a/packages/status-react/src/components/main-sidebar/components/sidebar-item/index.tsx b/packages/status-react/src/components/main-sidebar/components/sidebar-item/index.tsx index c9570ec7..223dc2cc 100644 --- a/packages/status-react/src/components/main-sidebar/components/sidebar-item/index.tsx +++ b/packages/status-react/src/components/main-sidebar/components/sidebar-item/index.tsx @@ -40,7 +40,7 @@ const Link = styled(NavLink, { fontWeight: '$500', fontSize: 15, display: 'inline-flex', - color: 'rgba(0, 0, 0, 0.7)', + color: '$accent-4', alignItems: 'center', width: '100%', gap: '$2', @@ -48,19 +48,21 @@ const Link = styled(NavLink, { padding: 8, '&:hover': { - background: '#E9EDF1', + background: '$gray-3', }, '&.active': { - background: 'rgba(233, 237, 241, 1)', + color: '$accent-1', + background: '$gray-3', }, variants: { state: { muted: { - color: 'rgba(0, 0, 0, 0.4)', + color: '$accent-5', }, unread: { + color: '$accent-1', fontWeight: '$600', '&::after': { content: '"1"', diff --git a/packages/status-react/src/components/main-sidebar/index.tsx b/packages/status-react/src/components/main-sidebar/index.tsx index 55a6e194..a843451c 100644 --- a/packages/status-react/src/components/main-sidebar/index.tsx +++ b/packages/status-react/src/components/main-sidebar/index.tsx @@ -1,6 +1,7 @@ import React from 'react' import { styled } from '~/src/styles/config' +import { Separator } from '~/src/system' import { Channels } from './components/channels' import { CommunityInfo } from './components/community-info' @@ -12,9 +13,9 @@ export const MainSidebar = () => { - + - + ) @@ -26,17 +27,10 @@ const Wrapper = styled('div', { flexDirection: 'column', padding: '10px 16px', display: 'none', - backgroundColor: '#F6F8FA', + backgroundColor: '$gray-4', overflowY: 'scroll', '@medium': { display: 'flex', }, }) - -const Separator = styled('div', { - margin: '16px 0', - height: 1, - background: 'rgba(0, 0, 0, 0.1)', - flexShrink: 0, -}) diff --git a/packages/status-react/src/components/member-sidebar/index.tsx b/packages/status-react/src/components/member-sidebar/index.tsx index 70a36893..790bf7d1 100644 --- a/packages/status-react/src/components/member-sidebar/index.tsx +++ b/packages/status-react/src/components/member-sidebar/index.tsx @@ -50,7 +50,7 @@ const Wrapper = styled('div', { flexShrink: 0, padding: '18px 16px', display: 'none', - backgroundColor: '#F6F8FA', + backgroundColor: '$gray-4', overflowY: 'scroll', '@medium': { diff --git a/packages/status-react/src/components/member-sidebar/member-item.tsx b/packages/status-react/src/components/member-sidebar/member-item.tsx index 154fbf5a..c3287ad2 100644 --- a/packages/status-react/src/components/member-sidebar/member-item.tsx +++ b/packages/status-react/src/components/member-sidebar/member-item.tsx @@ -23,7 +23,7 @@ export const MemberItem = (props: Props) => { />
- + {children} {verified && ( diff --git a/packages/status-react/src/modules/community/index.tsx b/packages/status-react/src/modules/community/index.tsx index 7aa4ddc3..2f465831 100644 --- a/packages/status-react/src/modules/community/index.tsx +++ b/packages/status-react/src/modules/community/index.tsx @@ -1,7 +1,6 @@ import React, { useRef } from 'react' import { BrowserRouter } from 'react-router-dom' -import styled, { ThemeProvider } from 'styled-components' import { AppProvider } from '~/src/contexts/app-context' import { ChatStateProvider } from '~/src/contexts/chatStateProvider' @@ -12,6 +11,7 @@ import { ModalProvider } from '~/src/contexts/modalProvider' import { NarrowProvider } from '~/src/contexts/narrowProvider' import { ScrollProvider } from '~/src/contexts/scrollProvider' import { ToastProvider } from '~/src/contexts/toastProvider' +import { styled } from '~/src/styles/config' import { GlobalStyle } from '~/src/styles/GlobalStyle' import { Messenger } from './messenger' @@ -34,30 +34,28 @@ export const Community = (props: Props) => { - - - - - - - - - - - -