Просмотр исходного кода

💄 refactor(playground): migrate inline styles to TailwindCSS v3 classes

- Replace all inline style objects with TailwindCSS utility classes
- Convert Layout and Layout.Sider component styles to responsive classes
- Simplify conditional styling logic using template literals
- Maintain existing responsive design and functionality
- Improve code readability and maintainability

Changes include:
- Layout: height/background styles → h-full bg-transparent
- Sider: complex style object → conditional className with mobile/desktop variants
- Debug panel overlay: inline styles → utility classes (fixed, z-[1000], etc.)
- Remove redundant style props while preserving visual consistency
t0ng7u 7 месяцев назад
Родитель
Сommit
8bc6ddbca8
2 измененных файлов с 12 добавлено и 34 удалено
  1. 1 1
      web/src/components/playground/FloatingButtons.js
  2. 11 33
      web/src/pages/Playground/index.js

+ 1 - 1
web/src/components/playground/FloatingButtons.js

@@ -80,7 +80,7 @@ const FloatingButtons = ({
               ? 'linear-gradient(to right, #e11d48, #be123c)'
               ? 'linear-gradient(to right, #e11d48, #be123c)'
               : 'linear-gradient(to right, #4f46e5, #6366f1)',
               : 'linear-gradient(to right, #4f46e5, #6366f1)',
           }}
           }}
-          className="lg:hidden !rounded-full !p-0"
+          className="lg:hidden"
         />
         />
       )}
       )}
     </>
     </>

+ 11 - 33
web/src/pages/Playground/index.js

@@ -371,28 +371,18 @@ const Playground = () => {
   }, [setMessage, saveMessagesImmediately]);
   }, [setMessage, saveMessagesImmediately]);
 
 
   return (
   return (
-    <div className="h-full bg-gray-50 mt-[60px]">
-      <Layout style={{ height: '100%', background: 'transparent' }} className="flex flex-col md:flex-row">
+    <div className="h-full">
+      <Layout className="h-full bg-transparent flex flex-col md:flex-row">
         {(showSettings || !isMobile) && (
         {(showSettings || !isMobile) && (
           <Layout.Sider
           <Layout.Sider
-            style={{
-              background: 'transparent',
-              borderRight: 'none',
-              flexShrink: 0,
-              minWidth: isMobile ? '100%' : 320,
-              maxWidth: isMobile ? '100%' : 320,
-              height: isMobile ? 'auto' : 'calc(100vh - 66px)',
-              overflow: 'auto',
-              position: isMobile ? 'fixed' : 'relative',
-              zIndex: isMobile ? 1000 : 1,
-              width: '100%',
-              top: 0,
-              left: 0,
-              right: 0,
-              bottom: 0,
-            }}
+            className={`
+              bg-transparent border-r-0 flex-shrink-0 overflow-auto mt-[60px]
+              ${isMobile
+                ? 'fixed top-0 left-0 right-0 bottom-0 z-[1000] w-full h-auto bg-white shadow-lg'
+                : 'relative z-[1] w-80 h-[calc(100vh-66px)]'
+              }
+            `}
             width={isMobile ? '100%' : 320}
             width={isMobile ? '100%' : 320}
-            className={isMobile ? 'bg-white shadow-lg' : ''}
           >
           >
             <OptimizedSettingsPanel
             <OptimizedSettingsPanel
               inputs={inputs}
               inputs={inputs}
@@ -418,7 +408,7 @@ const Playground = () => {
         )}
         )}
 
 
         <Layout.Content className="relative flex-1 overflow-hidden">
         <Layout.Content className="relative flex-1 overflow-hidden">
-          <div className="overflow-hidden flex flex-col lg:flex-row h-[calc(100vh-66px)]">
+          <div className="overflow-hidden flex flex-col lg:flex-row h-[calc(100vh-66px)] mt-[60px]">
             <div className="flex-1 flex flex-col">
             <div className="flex-1 flex flex-col">
               <ChatArea
               <ChatArea
                 chatRef={chatRef}
                 chatRef={chatRef}
@@ -455,19 +445,7 @@ const Playground = () => {
 
 
           {/* 调试面板 - 移动端覆盖层 */}
           {/* 调试面板 - 移动端覆盖层 */}
           {showDebugPanel && isMobile && (
           {showDebugPanel && isMobile && (
-            <div
-              style={{
-                position: 'fixed',
-                top: 0,
-                left: 0,
-                right: 0,
-                bottom: 0,
-                zIndex: 1000,
-                backgroundColor: 'white',
-                overflow: 'auto',
-              }}
-              className="shadow-lg"
-            >
+            <div className="fixed top-0 left-0 right-0 bottom-0 z-[1000] bg-white overflow-auto shadow-lg">
               <OptimizedDebugPanel
               <OptimizedDebugPanel
                 debugData={debugData}
                 debugData={debugData}
                 activeDebugTab={activeDebugTab}
                 activeDebugTab={activeDebugTab}