Browse Source

修改需求

bill 2 years ago
parent
commit
e937e360b3

+ 3 - 2
src/components/tabs/index.tsx

@@ -6,11 +6,12 @@ import type { ReactNode, Key } from 'react'
 export type TabsProps<T> = { 
   onChange: (type: string) => void, 
   active: T,
+  className?: string,
   renderContent: (tab: T) => ReactNode,
   items: Array<readonly [T, string]>
 }
 
-export const Tabs = <T extends Key>({ onChange, active, renderContent, items }: TabsProps<T>) => {
+export const Tabs = <T extends Key>({ onChange, active, className = '', renderContent, items }: TabsProps<T>) => {
   const renderOptions =items.map(([key, value]) => ({
     label: value,
     key: key.toString(),
@@ -21,7 +22,7 @@ export const Tabs = <T extends Key>({ onChange, active, renderContent, items }:
     }))
 
   return (
-    <div className={style['tab']}>
+    <div className={`${style['tab']} ${className}`}>
       <ATabs 
         onChange={key => onChange(key)} 
         activeKey={active.toString()}

+ 1 - 1
src/index.tsx

@@ -2,8 +2,8 @@ import React from 'react';
 import ReactDOM from 'react-dom/client';
 import { AppRouter } from 'router'
 import { AppStore } from 'store'
-import './public.scss'
 import 'antd/dist/antd.less';
+import './public.scss'
 import zhCN from 'antd/es/locale/zh_CN';
 import { ConfigProvider } from 'antd';
 

+ 9 - 0
src/public.scss

@@ -28,4 +28,13 @@ html, body, #root {
 
 .ant-table-tbody > tr > td {
   word-break: break-all;
+}
+.ant-table-tbody > tr > td:first-child,
+.ant-table-thead > tr > th:first-child {
+  text-align: left;
+}
+
+.ant-table-tbody > tr > td,
+.ant-table-thead > tr > th {
+  text-align: center;
 }

+ 2 - 0
src/views/scene/index.tsx

@@ -2,6 +2,7 @@ import { SceneType, SceneTypeDesc } from 'constant'
 import { useStoreState } from 'hook'
 import { SceneTabContent } from './content'
 import { Tabs } from 'components'
+import style from './style.module.scss'
 
 import type { ComponentType } from 'react'
 
@@ -19,6 +20,7 @@ export const ScenePage = ({ TabContent = SceneTabContent }: ScenePageProps) => {
   
   return (
     <Tabs
+      className={style['scene-tab']}
       items={tabItems} 
       active={type} 
       onChange={type => setType(Number(type))} 

+ 4 - 0
src/views/scene/style.module.scss

@@ -17,4 +17,8 @@
   &:hover span {
     opacity: 1;
   }
+}
+
+.scene-tab :global(.ant-tabs > .ant-tabs-nav) {
+  margin-bottom: 0;
 }