style(ideContainer): 优化页面布局和样式

- 调整 IDEContainer 高度为 calc(100vh - 60px)
- 移除侧边栏固定定位和额外样式- 统一组件列表等元素的高度为 100%
- 调整子菜单最小高度为 calc(100vh - 60px)
master
钟良源 5 months ago
parent 92d25a9fdc
commit 0ead4403d8

@ -17,16 +17,16 @@ type UrlParamsOptions = {
[key: string]: string [key: string]: string
}; };
const CompListComponent = () => <div style={{ height: '70vh', width: '100%' }}></div>; const CompListComponent = () => <div style={{ height: '100%', width: '100%' }}></div>;
const AppInstanceComponent = () => <div style={{ height: '70vh', width: '100%' }}></div>; const AppInstanceComponent = () => <div style={{ height: '100%', width: '100%' }}></div>;
const EventComponent = () => <div style={{ height: '70vh', width: '100%' }}></div>; const EventComponent = () => <div style={{ height: '100%', width: '100%' }}></div>;
const GlobalVarComponent = () => <div style={{ height: '70vh', width: '100%' }}></div>; const GlobalVarComponent = () => <div style={{ height: '100%', width: '100%' }}></div>;
const MyComponents = () => <div style={{ height: '70vh', width: '100%' }}></div>; const MyComponents = () => <div style={{ height: '100%', width: '100%' }}></div>;
const MatchingComponents = () => <div style={{ height: '70vh', width: '100%' }}></div>; const MatchingComponents = () => <div style={{ height: '100%', width: '100%' }}></div>;
const ComponentReview = () => <div style={{ height: '70vh', width: '100%' }}></div>; const ComponentReview = () => <div style={{ height: '100%', width: '100%' }}></div>;
const ComponentCoding = () => <div style={{ height: '70vh', width: '100%' }}></div>; const ComponentCoding = () => <div style={{ height: '100%', width: '100%' }}></div>;
const ComponentDeployment = () => <div style={{ height: '70vh', width: '100%' }}></div>; const ComponentDeployment = () => <div style={{ height: '100%', width: '100%' }}></div>;
const ComponentTest = () => <div style={{ height: '70vh', width: '100%' }}></div>; const ComponentTest = () => <div style={{ height: '100%', width: '100%' }}></div>;
function IDEContainer() { function IDEContainer() {
@ -87,7 +87,7 @@ function IDEContainer() {
style={{ style={{
width: subMenuWidth, width: subMenuWidth,
height: '100%', height: '100%',
minHeight: 'calc(100vh - 40px)' minHeight: 'calc(100vh - 60px)'
}} }}
onMoving={handleSubMenuResize} onMoving={handleSubMenuResize}
> >

@ -1,9 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import styles from './style/sideBar.module.less'; import styles from './style/sideBar.module.less';
import { IconApps } from '@arco-design/web-react/icon'; import { IconApps } from '@arco-design/web-react/icon';
import { GlobalState } from '@/store';
import { useSelector } from 'react-redux';
import getUrlParams from '@/utils/getUrlParams';
import { menuData, menuData2 } from './config/menuData'; import { menuData, menuData2 } from './config/menuData';
interface MenuItemType { interface MenuItemType {
@ -20,16 +17,7 @@ interface SideBarProps {
} }
const SideBar: React.FC<SideBarProps> = ({ onMenuSelect, selectedKey, identity }) => { const SideBar: React.FC<SideBarProps> = ({ onMenuSelect, selectedKey, identity }) => {
const urlParams = getUrlParams();
const [menu, setMenu] = useState<MenuItemType[]>([]); const [menu, setMenu] = useState<MenuItemType[]>([]);
const { settings } = useSelector(
(state: GlobalState) => state
);
const navbarHeight = 60;
const showNavbar = settings?.navbar && urlParams.navbar !== false;
const paddingTop = showNavbar ? { paddingTop: navbarHeight } : {};
const sideBarStyle = { ...paddingTop, height: '100%' };
function getMenuData(): MenuItemType[] { function getMenuData(): MenuItemType[] {
switch (identity) { switch (identity) {
@ -49,7 +37,6 @@ const SideBar: React.FC<SideBarProps> = ({ onMenuSelect, selectedKey, identity }
return ( return (
<div <div
className={styles.sider} className={styles.sider}
style={sideBarStyle}
> >
<div className={styles['menu-container']}> <div className={styles['menu-container']}>
{menu.map((item, index) => ( {menu.map((item, index) => (

@ -2,7 +2,7 @@
.IDEContainer { .IDEContainer {
width: 100%; width: 100%;
height: 100%; height: calc(100vh - 60px);
padding: 0; padding: 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -24,7 +24,7 @@
padding: 16px; padding: 16px;
> div { > div {
flex: 1; height: 100%;
} }
} }
} }

@ -1,21 +1,9 @@
.sider { .sider {
width: 60px;
height: 100%;
overflow-y: auto;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08); box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08);
z-index: 99;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
position: fixed;
top: 0;
left: 0;
background-color: var(--color-bg-2); background-color: var(--color-bg-2);
} }
.menu-container {
height: calc(100% - 40px); // 为底部留出空间
overflow-y: auto;
}
.menu-item { .menu-item {
padding: 12px 4px; padding: 12px 4px;
text-align: center; text-align: center;

Loading…
Cancel
Save