Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

lint: Use createStyles instead of CSS-in-JS

Rene Wang43d506cfa4b2
diff --git a/src/features/ResourceManager/index.tsx b/src/features/ResourceManager/index.tsx
index f0b0ae1f737..b670c793647 100644
--- a/src/features/ResourceManager/index.tsx
+++ b/src/features/ResourceManager/index.tsx
@@ -1,7 +1,7 @@
'use client';
import { Flexbox } from '@lobehub/ui';
-import { cssVar, useTheme } from 'antd-style';
+import { createStyles, cssVar } from 'antd-style';
import dynamic from 'next/dynamic';
import { memo, useEffect } from 'react';
import { useSearchParams } from 'react-router-dom';
@@ -18,6 +18,34 @@ import UploadDock from './components/UploadDock';
const ChunkDrawer = dynamic(() => import('./components/ChunkDrawer'), { ssr: false });
+const useStyles = createStyles(({ css, token }) => {
+ return {
+ container: css`
+ position: relative;
+ `,
+ editorOverlay: css`
+ position: absolute;
+ z-index: 1;
+ inset: 0;
+
+ width: 100%;
+ height: 100%;
+
+ background-color: ${token.colorBgContainerSecondary};
+ `,
+ pageEditorOverlay: css`
+ position: absolute;
+ z-index: 1;
+ inset: 0;
+
+ width: 100%;
+ height: 100%;
+
+ background-color: ${cssVar.colorBgLayout};
+ `,
+ };
+});
+
export type ResouceManagerMode = 'editor' | 'explorer' | 'page';
/**
@@ -26,7 +54,7 @@ export type ResouceManagerMode = 'editor' | 'explorer' | 'page';
* Business component, no need be reusable.
*/
const ResourceManager = memo(() => {
- const theme = useTheme();
+ const { styles } = useStyles();
const [, setSearchParams] = useSearchParams();
const [mode, currentViewItemId, libraryId, setMode, setCurrentViewItemId] =
useResourceManagerStore((s) => [
@@ -66,38 +94,20 @@ const ResourceManager = memo(() => {
return (
<>
- <Flexbox height={'100%'} style={{ position: 'relative' }}>
+ <Flexbox className={styles.container} height={'100%'}>
{/* Explorer is always rendered to preserve its state */}
<Explorer />
{/* Editor overlay */}
{mode === 'editor' && (
- <Flexbox
- height={'100%'}
- style={{
- backgroundColor: theme.colorBgContainerSecondary,
- inset: 0,
- position: 'absolute',
- zIndex: 1,
- }}
- width={'100%'}
- >
+ <Flexbox className={styles.editorOverlay}>
<Editor onBack={handleBack} />
</Flexbox>
)}
{/* PageEditor overlay */}
{mode === 'page' && (
- <Flexbox
- height={'100%'}
- style={{
- backgroundColor: cssVar.colorBgLayout,
- inset: 0,
- position: 'absolute',
- zIndex: 1,
- }}
- width={'100%'}
- >
+ <Flexbox className={styles.pageEditorOverlay}>
<PageEditor
knowledgeBaseId={libraryId}
onBack={handleBack}