diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index d3fedd774f..29463e9202 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -44,6 +44,7 @@ const getRedirectConfig = profile => { const nextConfig = { productionBrowserSourceMaps: true, compiler: { + styledComponents: true, removeConsole: { exclude: ['error', 'log', 'warn', 'info'], }, @@ -85,6 +86,7 @@ const nextConfig = { loader: 'raw-loader', }); config.resolve.alias['yjs'] = require.resolve('yjs'); + config.resolve.alias['@mui/styled-engine'] = '@mui/styled-engine-sc'; if (!isServer && !dev) { config.devtool = 'hidden-nosources-source-map'; diff --git a/apps/web/package.json b/apps/web/package.json index 15dd247d76..757469bc73 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -20,18 +20,22 @@ "@blocksuite/react": "0.5.0-20230303192351-13b0dd7", "@blocksuite/store": "0.5.0-20230303192351-13b0dd7", "@emotion/cache": "^11.10.5", - "@emotion/css": "^11.10.6", "@emotion/react": "^11.10.6", + "@emotion/server": "^11.10.0", + "@emotion/styled": "^11.10.6", "@mui/material": "^5.11.11", + "@mui/styled-engine-sc": "^5.11.11", "cmdk": "^0.1.22", "css-spring": "^4.1.0", "dayjs": "^1.11.7", "jotai": "^2.0.3", "jotai-devtools": "^0.2.0", "lit": "^2.6.1", + "next-themes": "^0.2.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-helmet-async": "^1.3.0", + "styled-components": "^5.3.8", "swr": "^2.0.4", "y-indexeddb": "^9.0.9", "y-protocols": "^1.0.5", diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/style.ts b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/style.ts index d54051664f..954a5c4901 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/style.ts +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/collaboration/style.ts @@ -98,4 +98,4 @@ export const StyledMoreVerticalDiv = styled('div')(() => { }; }); -export const StyledMoreVerticalButton = styled(StyledMoreVerticalDiv)(); +export const StyledMoreVerticalButton = styled(StyledMoreVerticalDiv)``; diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/general/style.ts b/apps/web/src/components/affine/workspace-setting-detail/panel/general/style.ts index 4886505b09..bdca89feaa 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/general/style.ts +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/general/style.ts @@ -9,7 +9,7 @@ export const StyledInput = styled(Input)(({ theme }) => { }; }); -export const StyledWorkspaceInfo = styled.div(({ theme }) => { +export const StyledWorkspaceInfo = styled('div')(({ theme }) => { return { ...displayFlex('flex-start', 'center'), fontSize: '20px', diff --git a/apps/web/src/components/affine/workspace-setting-detail/style.ts b/apps/web/src/components/affine/workspace-setting-detail/style.ts index c58c40af2e..a81e42e8a5 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/style.ts +++ b/apps/web/src/components/affine/workspace-setting-detail/style.ts @@ -43,7 +43,7 @@ export const WorkspaceSettingTagItem = styled('li')<{ isActive?: boolean }>( } ); -export const StyledSettingKey = styled.div(({ theme }) => { +export const StyledSettingKey = styled('div')(({ theme }) => { return { width: '140px', fontSize: theme.font.base, @@ -65,7 +65,7 @@ export const StyledWorkspaceName = styled('span')(({ theme }) => { }; }); -export const StyledIndicator = styled.div(({ theme }) => { +export const StyledIndicator = styled('div')(({ theme }) => { return { height: '2px', background: theme.colors.primaryColor, @@ -76,14 +76,14 @@ export const StyledIndicator = styled.div(({ theme }) => { }; }); -export const StyledTabButtonWrapper = styled.div(() => { +export const StyledTabButtonWrapper = styled('div')(() => { return { display: 'flex', position: 'relative', }; }); -// export const StyledDownloadCard = styled.div<{ active?: boolean }>( +// export const StyledDownloadCard = styled('div')<{ active?: boolean }>( // ({ theme, active }) => { // return { // width: '240px', @@ -105,7 +105,7 @@ export const StyledTabButtonWrapper = styled.div(() => { // }; // } // ); -// export const StyledDownloadCardDes = styled.div(({ theme }) => { +// export const StyledDownloadCardDes = styled('div')(({ theme }) => { // return { // fontSize: theme.font.sm, // color: theme.colors.iconColor, diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx index 49bfa41f02..d6ad11c0af 100644 --- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx +++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/index.tsx @@ -14,14 +14,17 @@ import { PaperIcon, } from '@blocksuite/icons'; import { PageMeta } from '@blocksuite/store'; -import { useMediaQuery, useTheme as useMuiTheme } from '@mui/material'; +import { + useMediaQuery, + useTheme as useMuiTheme, + useTheme, +} from '@mui/material'; import React, { useMemo } from 'react'; import { usePageMeta, usePageMetaHelper, } from '../../../../hooks/use-page-meta'; -import { useTheme } from '../../../../providers/ThemeProvider'; import { BlockSuiteWorkspace } from '../../../../shared'; import DateCell from './DateCell'; import Empty from './Empty'; @@ -41,7 +44,7 @@ const FavoriteTag: React.FC = ({ pageMeta: { favorite }, onClick, }) => { - const { theme } = useTheme(); + const theme = useTheme(); const { t } = useTranslation(); return ( { +export const StyledTableContainer = styled('div')(() => { return { height: 'calc(100vh - 60px)', padding: '78px 72px', overflowY: 'auto', }; }); -export const StyledTitleWrapper = styled.div(({ theme }) => { +export const StyledTitleWrapper = styled('div')(({ theme }) => { return { ...displayFlex('flex-start', 'center'), a: { @@ -22,7 +22,7 @@ export const StyledTitleWrapper = styled.div(({ theme }) => { }, }; }); -export const StyledTitleLink = styled.div(({ theme }) => { +export const StyledTitleLink = styled('div')(({ theme }) => { return { maxWidth: '80%', marginRight: '18px', diff --git a/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx b/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx index 7ef97804bc..df44447f5a 100644 --- a/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx +++ b/apps/web/src/components/blocksuite/header/editor-mode-switch/index.tsx @@ -1,5 +1,6 @@ import { useTranslation } from '@affine/i18n'; import { assertExists } from '@blocksuite/store'; +import { useTheme } from '@mui/material'; import React, { cloneElement, CSSProperties, useEffect, useState } from 'react'; import { @@ -7,7 +8,6 @@ import { usePageMetaHelper, } from '../../../../hooks/use-page-meta'; // todo(himself65): remove `useTheme` hook -import { useTheme } from '../../../../providers/ThemeProvider'; import { BlockSuiteWorkspace } from '../../../../shared'; import { EdgelessIcon, PaperIcon } from './Icons'; import { @@ -20,9 +20,7 @@ import { import type { AnimateRadioItemProps, RadioItemStatus } from './type'; const PaperItem = ({ active }: { active?: boolean }) => { const { - theme: { - colors: { iconColor, primaryColor }, - }, + colors: { iconColor, primaryColor }, } = useTheme(); return ; @@ -30,9 +28,7 @@ const PaperItem = ({ active }: { active?: boolean }) => { const EdgelessItem = ({ active }: { active?: boolean }) => { const { - theme: { - colors: { iconColor, primaryColor }, - }, + colors: { iconColor, primaryColor }, } = useTheme(); return ; @@ -78,7 +74,7 @@ export const EditorModeSwitch: React.FC = ({ blockSuiteWorkspace, pageId, }) => { - const { mode: themeMode } = useTheme(); + const theme = useTheme(); const { setPageMeta } = usePageMetaHelper(blockSuiteWorkspace); const pageMeta = usePageMeta(blockSuiteWorkspace).find( meta => meta.id === pageId @@ -139,7 +135,10 @@ export const EditorModeSwitch: React.FC = ({ setRadioItemStatus(modifyRadioItemStatus()); }} /> -