Optimize layout and stylesheet

This commit is contained in:
2024-01-18 17:29:42 +08:00
parent 9bcf559718
commit 343152c9d3
9 changed files with 37 additions and 58 deletions

View File

@@ -100,10 +100,21 @@
} }
.submenu { .submenu {
display: none; visibility: hidden;
position: fixed; position: fixed;
padding-left: 20px; padding-left: 20px;
z-index: 10000; z-index: 10000;
animation: 0.1s ease forwards;
@include mixins.unique-keyframes {
0% {
transform: translateX(0);
opacity: 1;
}
100% {
transform: translateX(-10px);
opacity: 0;
}
}
.content { .content {
display: flex; display: flex;
@@ -144,7 +155,7 @@
} }
.submenu { .submenu {
display: block; visibility: visible;
animation: 0.3s ease; animation: 0.3s ease;
@include mixins.unique-keyframes { @include mixins.unique-keyframes {
0% { 0% {
@@ -185,6 +196,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex: 0 0 auto;
margin-left: 4px; margin-left: 4px;
width: 36px; width: 36px;
height: 36px; height: 36px;

View File

@@ -1,33 +1,18 @@
import { PropsWithChildren } from 'react' import { PropsWithChildren } from 'react'
import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar' import HideScrollbar from '@/components/common/HideScrollbar'
export interface SidebarScrollElement {
refreshLayout(): void
}
const Scroll = forwardRef<SidebarScrollElement, PropsWithChildren>((props, ref) => {
useImperativeHandle<SidebarScrollElement, SidebarScrollElement>(ref, () => {
return {
refreshLayout() {
hideScrollbarRef.current?.refreshLayout()
}
}
})
const hideScrollbarRef = useRef<HideScrollbarElement>(null)
const Scroll = (props: PropsWithChildren) => {
return ( return (
<div className={'scroll'}> <div className={'scroll'}>
<HideScrollbar <HideScrollbar
isShowVerticalScrollbar={true} isShowVerticalScrollbar={true}
scrollbarWidth={2} scrollbarWidth={2}
autoHideWaitingTime={800} autoHideWaitingTime={800}
ref={hideScrollbarRef}
> >
{props.children} {props.children}
</HideScrollbar> </HideScrollbar>
</div> </div>
) )
}) }
export default Scroll export default Scroll

View File

@@ -594,7 +594,7 @@ const Group = () => {
) )
const addAndEditForm = ( const addAndEditForm = (
<AntdForm form={form} disabled={isSubmitting}> <AntdForm form={form} disabled={isSubmitting} layout={'vertical'}>
<AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}> <AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}>
<AntdInput disabled /> <AntdInput disabled />
</AntdForm.Item> </AntdForm.Item>
@@ -620,10 +620,10 @@ const Group = () => {
<AntdForm.Item <AntdForm.Item
valuePropName={'checked'} valuePropName={'checked'}
name={'enable'} name={'enable'}
label={'启用'} label={'状态'}
rules={[{ required: true, type: 'boolean' }]} rules={[{ required: true, type: 'boolean' }]}
> >
<AntdSwitch /> <AntdSwitch checkedChildren={'启用'} unCheckedChildren={'禁用'} />
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
) )
@@ -634,7 +634,7 @@ const Group = () => {
<HideScrollbar <HideScrollbar
style={{ padding: 30 }} style={{ padding: 30 }}
isShowVerticalScrollbar isShowVerticalScrollbar
autoHideWaitingTime={500} autoHideWaitingTime={1000}
> >
<FlexBox gap={20}> <FlexBox gap={20}>
{toolbar} {toolbar}
@@ -644,7 +644,6 @@ const Group = () => {
</FitFullscreen> </FitFullscreen>
<AntdDrawer <AntdDrawer
title={isDrawerEdit ? '编辑用户组' : '添加用户组'} title={isDrawerEdit ? '编辑用户组' : '添加用户组'}
width={'36vw'}
onClose={handleOnDrawerClose} onClose={handleOnDrawerClose}
open={isDrawerOpen} open={isDrawerOpen}
closable={!isSubmitting} closable={!isSubmitting}

View File

@@ -287,7 +287,7 @@ const Log = () => {
<HideScrollbar <HideScrollbar
style={{ padding: 30 }} style={{ padding: 30 }}
isShowVerticalScrollbar isShowVerticalScrollbar
autoHideWaitingTime={500} autoHideWaitingTime={1000}
> >
<FlexBox gap={20}> <FlexBox gap={20}>
{toolbar} {toolbar}

View File

@@ -603,7 +603,7 @@ const Role = () => {
) )
const addAndEditForm = ( const addAndEditForm = (
<AntdForm form={form} disabled={isSubmitting}> <AntdForm form={form} disabled={isSubmitting} layout={'vertical'}>
<AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}> <AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}>
<AntdInput disabled /> <AntdInput disabled />
</AntdForm.Item> </AntdForm.Item>
@@ -627,10 +627,10 @@ const Role = () => {
<AntdForm.Item <AntdForm.Item
valuePropName={'checked'} valuePropName={'checked'}
name={'enable'} name={'enable'}
label={'启用'} label={'状态'}
rules={[{ required: true, type: 'boolean' }]} rules={[{ required: true, type: 'boolean' }]}
> >
<AntdSwitch /> <AntdSwitch checkedChildren={'启用'} unCheckedChildren={'禁用'} />
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
) )
@@ -641,7 +641,7 @@ const Role = () => {
<HideScrollbar <HideScrollbar
style={{ padding: 30 }} style={{ padding: 30 }}
isShowVerticalScrollbar isShowVerticalScrollbar
autoHideWaitingTime={500} autoHideWaitingTime={1000}
> >
<FlexBox gap={20}> <FlexBox gap={20}>
{toolbar} {toolbar}
@@ -651,7 +651,6 @@ const Role = () => {
</FitFullscreen> </FitFullscreen>
<AntdDrawer <AntdDrawer
title={isDrawerEdit ? '编辑角色' : '添加角色'} title={isDrawerEdit ? '编辑角色' : '添加角色'}
width={'36vw'}
onClose={handleOnDrawerClose} onClose={handleOnDrawerClose}
open={isDrawerOpen} open={isDrawerOpen}
closable={!isSubmitting} closable={!isSubmitting}

View File

@@ -54,7 +54,7 @@ const Settings = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system-settings'}> <FitFullscreen data-component={'system-settings'}>
<HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={500}> <HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={1000}>
<FlexBox direction={'horizontal'} className={'root-content'}> <FlexBox direction={'horizontal'} className={'root-content'}>
<FlexBox className={'root-col'}> <FlexBox className={'root-col'}>
<Permission operationCode={'system:settings:query:base'}> <Permission operationCode={'system:settings:query:base'}>

View File

@@ -45,7 +45,7 @@ const Statistics = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system-statistics'}> <FitFullscreen data-component={'system-statistics'}>
<HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={500}> <HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={1000}>
<FlexBox direction={'horizontal'} className={'root-content'}> <FlexBox direction={'horizontal'} className={'root-content'}>
<Permission operationCode={'system:statistics:query:usage'}> <Permission operationCode={'system:statistics:query:usage'}>
<OnlineInfo /> <OnlineInfo />

View File

@@ -758,12 +758,7 @@ const User = () => {
]) ])
const addAndEditForm = ( const addAndEditForm = (
<AntdForm <AntdForm form={form} disabled={isDrawerSubmitting} layout={'vertical'}>
form={form}
disabled={isDrawerSubmitting}
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
>
<div <div
style={{ style={{
display: 'flex', display: 'flex',
@@ -847,16 +842,11 @@ const User = () => {
}))} }))}
/> />
</AntdForm.Item> </AntdForm.Item>
<AntdForm.Item name={'verified'} label={'验证'}> <AntdForm.Item name={'verified'} label={'验证'}>
<AntdSwitch /> <AntdSwitch checkedChildren={'已验证'} unCheckedChildren={'未验证'} />
</AntdForm.Item> </AntdForm.Item>
<AntdForm.Item <AntdForm.Item name={'locking'} label={'锁定'}>
valuePropName={'checked'} <AntdSwitch checkedChildren={'已锁定'} unCheckedChildren={'未锁定'} />
name={'locking'}
label={'锁定'}
rules={[{ type: 'boolean' }]}
>
<AntdSwitch />
</AntdForm.Item> </AntdForm.Item>
<AntdForm.Item <AntdForm.Item
name={'expiration'} name={'expiration'}
@@ -888,13 +878,8 @@ const User = () => {
style={{ width: '100%' }} style={{ width: '100%' }}
/> />
</AntdForm.Item> </AntdForm.Item>
<AntdForm.Item <AntdForm.Item name={'enable'} label={'启用'}>
valuePropName={'checked'} <AntdSwitch checkedChildren={'启用'} unCheckedChildren={'禁用'} />
name={'enable'}
label={'启用'}
rules={[{ type: 'boolean' }]}
>
<AntdSwitch />
</AntdForm.Item> </AntdForm.Item>
</> </>
)} )}
@@ -1012,7 +997,7 @@ const User = () => {
<HideScrollbar <HideScrollbar
style={{ padding: 30 }} style={{ padding: 30 }}
isShowVerticalScrollbar isShowVerticalScrollbar
autoHideWaitingTime={500} autoHideWaitingTime={1000}
> >
<FlexBox gap={20}> <FlexBox gap={20}>
{toolbar} {toolbar}
@@ -1022,7 +1007,6 @@ const User = () => {
</FitFullscreen> </FitFullscreen>
<AntdDrawer <AntdDrawer
title={isDrawerEdit ? '编辑用户' : '新增用户'} title={isDrawerEdit ? '编辑用户' : '新增用户'}
width={'36vw'}
onClose={handleOnDrawerClose} onClose={handleOnDrawerClose}
open={isDrawerOpen} open={isDrawerOpen}
closable={!isDrawerSubmitting} closable={!isDrawerSubmitting}

View File

@@ -65,7 +65,7 @@ const System = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system'}> <FitFullscreen data-component={'system'}>
<HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={500}> <HideScrollbar isShowVerticalScrollbar autoHideWaitingTime={1000}>
<FlexBox direction={'horizontal'} className={'root-content'}> <FlexBox direction={'horizontal'} className={'root-content'}>
<Permission path={'/system/statistics'}> <Permission path={'/system/statistics'}>
<CommonCard icon={IconOxygenAnalysis} url={'statistics'}> <CommonCard icon={IconOxygenAnalysis} url={'statistics'}>