Skip to content

Commit

Permalink
style: pagecontainer padding
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Jul 2, 2024
1 parent 13d71e2 commit 6989345
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/assets/styles/menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.ant-layout-sider-children {
background-color: var(--color-fill-1);
border-inline: none;
border-radius: var(--menu-border-radius-base);
border-radius: 0;
padding-inline: 16px;
padding-block-end: 12px;
}
Expand Down
12 changes: 11 additions & 1 deletion src/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ html {
--color-fill-3: #f3f6fa;
--color-logs-bg: #1e1e1e;
--color-logs-text: #d4d4d4;
--layout-content-blockpadding: 32px;
--layout-content-inlinepadding: 32px;
--menu-border-radius-base: 8px;
--border-radius-base: 8px;
--border-radius-middle: 20px;
Expand Down Expand Up @@ -40,7 +42,7 @@ html {
--ant-input-active-shadow: 0 0 0 2px rgba(5, 255, 105, 6%);
--ant-input-active-border-color: #2fbf85;
--ant-input-hover-border-color: #54cc98;
--box-shadow-base: 0 4px 12px rgb(227, 232, 240);
--box-shadow-base: 0 4px 12px rgba(227, 232, 240, 70%);

.css-var-rf {
--ant-font-size: var(--font-size-base);
Expand Down Expand Up @@ -272,6 +274,14 @@ body {

.ant-pro-layout {
height: 100vh;
// .ant-pro-layout-content {
// padding-block: var(--layout-content-blockpadding);
// padding-inline: var(--layout-content-inlinepadding);
// }
.ant-pro-page-container-children-container {
padding-block: var(--layout-content-blockpadding);
padding-inline: var(--layout-content-inlinepadding);
}

.ant-pro-sider-logo {
padding-left: 22px;
Expand Down
1 change: 0 additions & 1 deletion src/layouts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export default (props: any) => {
}
if (menuItemProps.path && location.pathname !== menuItemProps.path) {
return (
// handle wildcard route path, for example /slave/* from qiankun
<Link
to={menuItemProps.path.replace('/*', '')}
target={menuItemProps.target}
Expand Down
25 changes: 22 additions & 3 deletions src/layouts/rightRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ export function getRightRenderContent(opts: {
// 如果没有打开Locale,并且头像为空就取消掉这个返回的内容
if (!avatar) return null;

const renderMenu = () => {
return (
<Menu triggerSubMenuAction="hover">
<Menu.Item title="admin" key="avatar">
<ul>
<Menu.SubMenu
key="settings"
icon={<SettingOutlined />}
title={intl?.formatMessage?.({ id: 'common.button.settings' })}
></Menu.SubMenu>
<Menu.SubMenu
key="logout"
icon={<LogoutOutlined />}
title={intl?.formatMessage?.({ id: 'common.button.logout' })}
></Menu.SubMenu>
</ul>
</Menu.Item>
</Menu>
);
};
const langMenu = {
className: 'umi-plugin-layout-menu',
selectedKeys: [],
Expand Down Expand Up @@ -123,7 +143,7 @@ export function getRightRenderContent(opts: {

let dropdownProps;
if (version.startsWith('5.') || version.startsWith('4.24.')) {
dropdownProps = { menu: langMenu };
dropdownProps = { menu: langMenu, mode: 'vertical' };
} else if (version.startsWith('3.')) {
dropdownProps = {
overlay: (
Expand All @@ -138,7 +158,7 @@ export function getRightRenderContent(opts: {
};
} else {
// 需要 antd 4.20.0 以上版本
dropdownProps = { overlay: <Menu {...langMenu} /> };
dropdownProps = { overlay: <Menu {...langMenu} mode="vertical" /> };
}

return (
Expand All @@ -153,7 +173,6 @@ export function getRightRenderContent(opts: {
>
{avatar}
</Dropdown>
<span></span>
</>
) : (
avatar
Expand Down
1 change: 1 addition & 0 deletions src/pages/dashboard/components/resource-utilization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const UtilizationOvertime: React.FC = () => {
<LineChart
data={result}
locale={locale}
height={390}
labelFormatter={labelFormatter}
slider={sliderConfig}
/>
Expand Down
19 changes: 11 additions & 8 deletions src/pages/dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PageContainer } from '@ant-design/pro-components';
import { Spin } from 'antd';
import { useEffect, useState } from 'react';
import { queryDashboardData } from './apis';
Expand Down Expand Up @@ -27,14 +28,16 @@ const Dashboard: React.FC = () => {
getDashboardData();
}, []);
return (
<Spin spinning={loading}>
<DashboardContext.Provider value={{ ...data }}>
<Overview></Overview>
<SystemLoad></SystemLoad>
<Usage></Usage>
<ActiveTable></ActiveTable>
</DashboardContext.Provider>
</Spin>
<PageContainer ghost extra={[]}>
<Spin spinning={loading}>
<DashboardContext.Provider value={{ ...data }}>
<Overview></Overview>
<SystemLoad></SystemLoad>
<Usage></Usage>
<ActiveTable></ActiveTable>
</DashboardContext.Provider>
</Spin>
</PageContainer>
);
};

Expand Down
5 changes: 2 additions & 3 deletions src/pages/playground/components/ground-left.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import TransitionWrapper from '@/components/transition';
import HotKeys from '@/config/hotkeys';
import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data';
import { EyeInvisibleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Button, Input, Spin } from 'antd';
import _ from 'lodash';
Expand Down Expand Up @@ -185,7 +184,7 @@ const MessageList: React.FC<MessageProps> = (props) => {

return (
<div className="ground-left">
<PageContainer title={false} className="message-list-wrap">
<div className="message-list-wrap">
<div style={{ marginBottom: 40 }}>
<TransitionWrapper
header={renderLabel()}
Expand Down Expand Up @@ -227,7 +226,7 @@ const MessageList: React.FC<MessageProps> = (props) => {
</Spin>
)}
</div>
</PageContainer>
</div>
<div className="ground-left-footer">
<ChatFooter
onClear={handleClear}
Expand Down
8 changes: 4 additions & 4 deletions src/pages/playground/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CardWrapper from '@/components/card-wrapper';
import { PageContainer } from '@ant-design/pro-components';
import { useSearchParams } from '@umijs/max';
import { Divider } from 'antd';
import { useState } from 'react';
Expand Down Expand Up @@ -27,8 +27,8 @@ const Playground: React.FC = () => {
};

return (
<div style={{ padding: '32px 40px' }}>
<CardWrapper>
<div>
<PageContainer ghost extra={[]}>
<div className="play-ground">
<div className="chat">
<GroundLeft parameters={params}></GroundLeft>
Expand All @@ -45,7 +45,7 @@ const Playground: React.FC = () => {
/>
</div>
</div>
</CardWrapper>
</PageContainer>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/playground/style/chat-footer.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.chat-footer {
display: flex;
align-items: center;
padding-inline: 26px;
padding-inline: 0 32px;
height: 100px;
// box-shadow: 0px -1px 2px 0px var(--ant-color-border);
}
5 changes: 1 addition & 4 deletions src/pages/playground/style/ground-left.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
position: relative;
height: calc(100vh - 84px);
padding-bottom: 120px;
padding-right: 32px;

.message-list-wrap {
max-height: calc(100vh - 152px);
overflow-y: auto;

.ant-pro-page-container-children-container {
padding-inline: 16px 26px;
}
}

.ground-left-footer {
Expand Down
5 changes: 4 additions & 1 deletion src/pages/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const Profile: React.FC = () => {
extra={[]}
>
<CardWrapper
style={{ padding: '32px', marginTop: '70px', width: 'max-content' }}
style={{
padding: 'var(--layout-content-inlinepadding)',
width: 'max-content'
}}
>
<Form
style={{ width: '524px' }}
Expand Down

0 comments on commit 6989345

Please sign in to comment.