From 90dba82a59736ee2d0864e1ce50d9c907bad0d15 Mon Sep 17 00:00:00 2001 From: QiShaoXuan Date: Tue, 18 Oct 2022 17:08:42 +0800 Subject: [PATCH] feat: modify style variables --- packages/app/public/globals.css | 4 +- packages/app/src/components/Header/index.tsx | 2 +- packages/app/src/components/Header/styles.ts | 55 +++++------ .../components/editor-mode-switch/index.tsx | 26 ++--- .../components/editor-mode-switch/style.ts | 34 +++---- packages/app/src/components/faq/style.ts | 19 ++-- packages/app/src/components/popover/index.tsx | 8 +- .../src/components/simple-counter/index.ts | 2 +- .../src/components/theme-mode-switch/style.ts | 4 +- .../app/src/components/tooltip/Tooltip.tsx | 2 +- packages/app/src/pages/index.tsx | 14 +-- packages/app/src/pages/temporary.css | 74 +++++++------- packages/app/src/styles/theme.ts | 97 ++++++++++++++----- packages/app/src/styles/themeProvider.tsx | 4 +- packages/app/src/styles/types.ts | 55 ++++++++++- 15 files changed, 232 insertions(+), 168 deletions(-) diff --git a/packages/app/public/globals.css b/packages/app/public/globals.css index 62b1feadf..35d63bd2e 100644 --- a/packages/app/public/globals.css +++ b/packages/app/public/globals.css @@ -145,7 +145,7 @@ button, select, keygen, legend { - color: var(--page-text-color); + color: var(--affine-text-color); outline: 0; font-size: 18px; line-height: 1.5; @@ -156,7 +156,7 @@ body { } a, a:hover { - color: var(--page-text-color); + color: var(--affine-link-color); } input { diff --git a/packages/app/src/components/Header/index.tsx b/packages/app/src/components/Header/index.tsx index 4a982b436..504ec1c18 100644 --- a/packages/app/src/components/Header/index.tsx +++ b/packages/app/src/components/Header/index.tsx @@ -65,7 +65,7 @@ export const Header = () => { return ( - {}} /> + {}} /> { diff --git a/packages/app/src/components/Header/styles.ts b/packages/app/src/components/Header/styles.ts index 8162ca2ea..16ac015e7 100644 --- a/packages/app/src/components/Header/styles.ts +++ b/packages/app/src/components/Header/styles.ts @@ -33,14 +33,10 @@ export const StyledTitleWrapper = styled('div')({ position: 'relative', }); -export const StyledLogo = styled('div')({}); - -export const StyledModeSwitch = styled('div')({ - height: '100%', - display: 'flex', - alignItems: 'center', - marginRight: '12px', -}); +export const StyledLogo = styled('div')(({ theme }) => ({ + color: theme.colors.primaryColor, + cursor: 'pointer', +})); export const StyledHeaderRightSide = styled('div')({ height: '100%', @@ -48,27 +44,25 @@ export const StyledHeaderRightSide = styled('div')({ alignItems: 'center', }); -export const StyledMoreMenuItem = styled('div')({ - height: '32px', - display: 'flex', - alignItems: 'center', - borderRadius: '5px', - fontSize: '14px', - color: '#4C6275', - padding: '0 14px', - svg: { - fill: '#4C6275', - width: '16px', - height: '16px', - marginRight: '14px', - }, - ':hover': { - color: 'var(--affine-highlight-color)', - background: '#F1F3FF', +export const StyledMoreMenuItem = styled('div')(({ theme }) => { + return { + height: '32px', + display: 'flex', + alignItems: 'center', + borderRadius: '5px', + fontSize: '14px', + color: theme.colors.popoverColor, + padding: '0 14px', svg: { - fill: 'var(--affine-highlight-color)', + width: '16px', + height: '16px', + marginRight: '14px', }, - }, + ':hover': { + color: theme.colors.primaryColor, + background: theme.colors.hoverBackground, + }, + }; }); export const IconButton = styled('div')(({ theme }) => { @@ -78,12 +72,11 @@ export const IconButton = styled('div')(({ theme }) => { display: 'flex', justifyContent: 'center', alignItems: 'center', - color: theme.colors.disabled, - background: 'transparent', + color: theme.colors.iconColor, borderRadius: '5px', ':hover': { - color: theme.colors.highlight, - background: '#F1F3FF', + color: theme.colors.primaryColor, + background: theme.colors.hoverBackground, }, }; }); diff --git a/packages/app/src/components/editor-mode-switch/index.tsx b/packages/app/src/components/editor-mode-switch/index.tsx index 9558abc75..94bc5c520 100644 --- a/packages/app/src/components/editor-mode-switch/index.tsx +++ b/packages/app/src/components/editor-mode-switch/index.tsx @@ -1,7 +1,6 @@ import React, { useState, useEffect, cloneElement } from 'react'; import { StyledAnimateRadioContainer, - StyledRadioMiddle, StyledMiddleLine, StyledRadioItem, StyledLabel, @@ -19,21 +18,21 @@ import { useEditor } from '@/components/editor-provider'; const PaperItem = ({ active }: { active?: boolean }) => { const { theme: { - colors: { highlight, disabled }, + colors: { iconColor, primaryColor }, }, } = useTheme(); - return ; + return ; }; const EdgelessItem = ({ active }: { active?: boolean }) => { const { theme: { - colors: { highlight, disabled }, + colors: { iconColor, primaryColor }, }, } = useTheme(); - return ; + return ; }; const AnimateRadioItem = ({ @@ -57,24 +56,11 @@ const AnimateRadioItem = ({ ); }; -const RadioMiddle = ({ - isHover, - direction, -}: { - isHover: boolean; - direction: 'left' | 'right' | 'middle'; -}) => { - return ( - - ); -}; - export const EditorModeSwitch = ({ isHover, style = {}, }: AnimateRadioProps) => { + const { mode: themeMode } = useTheme(); const { mode, setMode } = useEditor(); const modifyRadioItemStatus = (): RadioItemStatus => { return { @@ -124,7 +110,7 @@ export const EditorModeSwitch = ({ setRadioItemStatus(modifyRadioItemStatus()); }} /> -