mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 01:17:43 +00:00
perf(MobileActionPage): improve style performance
This commit is contained in:
parent
e84fe5e23b
commit
0e7a85748f
@ -7,35 +7,37 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { createStyles } from '@nocobase/client';
|
||||
import { genStyleHook } from '@nocobase/client';
|
||||
|
||||
export const useMobileActionPageStyle = genStyleHook('nb-mobile-action-page', (token) => {
|
||||
const { componentCls } = token;
|
||||
|
||||
export const useMobileActionPageStyle = createStyles(({ css, token }: any) => {
|
||||
return {
|
||||
container: css`
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: ${token.colorBgLayout};
|
||||
[componentCls]: {
|
||||
position: 'absolute !important',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
backgroundColor: token.colorBgLayout,
|
||||
|
||||
.mobile-page-content > .nb-grid-container > .nb-grid > .nb-grid-warp > .ant-btn {
|
||||
margin: 20px;
|
||||
}
|
||||
`,
|
||||
'.mobile-page-content > .nb-grid-container > .nb-grid > .nb-grid-warp > .ant-btn': {
|
||||
margin: 20,
|
||||
},
|
||||
|
||||
footer: css`
|
||||
height: var(--nb-mobile-page-header-height);
|
||||
padding-right: var(--nb-mobile-page-tabs-content-padding);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
z-index: 1000;
|
||||
`,
|
||||
};
|
||||
'.nb-mobile-action-page-footer': {
|
||||
height: 'var(--nb-mobile-page-header-height)',
|
||||
paddingRight: 'var(--nb-mobile-page-tabs-content-padding)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
backgroundColor: 'white',
|
||||
zIndex: 1000,
|
||||
},
|
||||
},
|
||||
} as any;
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ export const MobileActionPage = ({ level, footerNodeName }) => {
|
||||
const field = useField();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const ctx = useActionContext();
|
||||
const { styles } = useMobileActionPageStyle();
|
||||
const { componentCls, hashId } = useMobileActionPageStyle();
|
||||
const tabContext = useTabsContext();
|
||||
const containerDOM = useMemo(() => document.querySelector('.nb-mobile-subpages-slot'), []);
|
||||
const { basicZIndex } = useBasicZIndex();
|
||||
@ -59,12 +59,12 @@ export const MobileActionPage = ({ level, footerNodeName }) => {
|
||||
|
||||
const actionPageNode = (
|
||||
<BasicZIndexProvider basicZIndex={newZIndex}>
|
||||
<div className={styles.container} style={zIndexStyle}>
|
||||
<div className={`${componentCls} ${hashId}`} style={zIndexStyle}>
|
||||
<TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />} tabBarGutter={48}>
|
||||
<SchemaComponent components={components} schema={fieldSchema} onlyRenderProperties />
|
||||
</TabsContextProvider>
|
||||
{footerSchema && (
|
||||
<div className={styles.footer} style={zIndexStyle}>
|
||||
<div className="nb-mobile-action-page-footer" style={zIndexStyle}>
|
||||
<RecursionField
|
||||
basePath={field.address}
|
||||
schema={fieldSchema}
|
||||
|
Loading…
Reference in New Issue
Block a user