fix: mobile style bug (#4934)

This commit is contained in:
jack zhang 2024-07-23 16:01:41 +08:00 committed by GitHub
parent 2000e289fa
commit 31997b05f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 40 additions and 24 deletions

View File

@ -47,6 +47,10 @@ export interface CustomToken extends AliasToken {
marginBlock: number; marginBlock: number;
/** 区块的圆角 */ /** 区块的圆角 */
borderRadiusBlock: number; borderRadiusBlock: number;
/** 区块的 boxShadow */
boxShadowBlock: string;
/** 区块的下边框 */
borderBottomBlock: string;
} }
export interface ThemeConfig extends _ThemeConfig { export interface ThemeConfig extends _ThemeConfig {

View File

@ -15,6 +15,10 @@ const useStyles = genStyleHook('nb-card-item', (token) => {
return { return {
[componentCls]: { [componentCls]: {
marginBottom: token.marginBlock, marginBottom: token.marginBlock,
'> .ant-card': {
boxShadow: token.boxShadowBlock,
borderBottom: token.borderBottomBlock,
},
}, },
}; };
}); });

View File

@ -5,8 +5,8 @@
"homepage": "https://docs.nocobase.com/handbook/mobile-client", "homepage": "https://docs.nocobase.com/handbook/mobile-client",
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile-client", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile-client",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"displayName": "Mobile client", "displayName": "Mobile client(Deprecated)",
"displayName.zh-CN": "移动端", "displayName.zh-CN": "移动端(已废弃)",
"description": "Provides the ability to configure mobile pages.", "description": "Provides the ability to configure mobile pages.",
"description.zh-CN": "提供移动端页面配置的能力。", "description.zh-CN": "提供移动端页面配置的能力。",
"devDependencies": { "devDependencies": {

View File

@ -5,8 +5,8 @@
"homepage": "https://docs.nocobase.com/handbook/mobile", "homepage": "https://docs.nocobase.com/handbook/mobile",
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"displayName": "Mobile", "displayName": "Mobile(Developing)",
"displayName.zh-CN": "移动端", "displayName.zh-CN": "移动端(开发中)",
"description": "Provides the ability to configure mobile pages.", "description": "Provides the ability to configure mobile pages.",
"description.zh-CN": "提供移动端页面配置的能力。", "description.zh-CN": "提供移动端页面配置的能力。",
"peerDependencies": { "peerDependencies": {

View File

@ -47,7 +47,16 @@ export const Mobile = () => {
return ( return (
<DesktopComponent> <DesktopComponent>
{/* 目前移动端由于和客户端的主题对不上,所以先使用 `GlobalThemeProvider` 和 `AntdAppProvider` 进行重置为默认主题 */} {/* 目前移动端由于和客户端的主题对不上,所以先使用 `GlobalThemeProvider` 和 `AntdAppProvider` 进行重置为默认主题 */}
<GlobalThemeProvider> <GlobalThemeProvider
theme={{
token: {
marginBlock: 18,
borderRadiusBlock: 0,
boxShadowBlock: 'none',
borderBottomBlock: '1px solid var(--adm-color-border)',
},
}}
>
<AntdAppProvider> <AntdAppProvider>
<OpenModeProvider <OpenModeProvider
defaultOpenMode="page" defaultOpenMode="page"

View File

@ -13,14 +13,5 @@ export const useStyles = createStyles(() => ({
mobilePageContent: { mobilePageContent: {
maxWidth: '100%', maxWidth: '100%',
overflowX: 'hidden', overflowX: 'hidden',
'.ant-card': {
marginBottom: '18px !important',
borderRadius: '0 !important',
boxShadow: 'none',
borderBottom: '1px solid var(--adm-color-border)',
},
'.ant-nb-card-item': {
marginBottom: '18px !important',
},
}, },
})); }));

View File

@ -15,18 +15,12 @@ import {
useActionContext, useActionContext,
useTabsContext, useTabsContext,
} from '@nocobase/client'; } from '@nocobase/client';
import { ConfigProvider } from 'antd';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import { useMobileActionPageStyle } from './MobileActionPage.style'; import { useMobileActionPageStyle } from './MobileActionPage.style';
import { MobileTabsForMobileActionPage } from './MobileTabsForMobileActionPage'; import { MobileTabsForMobileActionPage } from './MobileTabsForMobileActionPage';
const components = { Tabs: MobileTabsForMobileActionPage }; const components = { Tabs: MobileTabsForMobileActionPage };
const theme: any = {
token: {
marginBlock: 18,
},
};
/** /**
* Action * Action
@ -53,9 +47,7 @@ export const MobileActionPage = ({ level }) => {
const actionPageNode = ( const actionPageNode = (
<div className={styles.container} style={style}> <div className={styles.container} style={style}>
<TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />} tabBarGutter={48}> <TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />} tabBarGutter={48}>
<ConfigProvider theme={theme}>
<SchemaComponent components={components} schema={filedSchema} onlyRenderProperties /> <SchemaComponent components={components} schema={filedSchema} onlyRenderProperties />
</ConfigProvider>
</TabsContextProvider> </TabsContextProvider>
</div> </div>
); );

View File

@ -262,7 +262,7 @@ const category: TokenTree<keyof AliasToken | string> = [
nameEn: 'Shadow', nameEn: 'Shadow',
desc: '', desc: '',
descEn: '', descEn: '',
mapToken: ['boxShadow', 'boxShadowSecondary'], mapToken: ['boxShadow', 'boxShadowSecondary', 'boxShadowBlock'],
}, },
], ],
}, },

View File

@ -1759,5 +1759,21 @@
"descEn": "Used to set the radius of the block", "descEn": "Used to set the radius of the block",
"type": "number", "type": "number",
"source": "map" "source": "map"
},
"boxShadowBlock": {
"name": "区块的阴影",
"nameEn": "Shadow of block",
"desc": "用于设置区块的阴影",
"descEn": "Used to set the shadow of the block",
"type": "string",
"source": "map"
},
"borderBottomBlock": {
"name": "区块的底边框",
"nameEn": "Bottom border of block",
"desc": "用于设置区块的底边框",
"descEn": "Used to set the bottom border of the block",
"type": "string",
"source": "map"
} }
} }