mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 23:46:02 +00:00
perf(MobilePageContentContainer): improve style performance
This commit is contained in:
parent
58ed5229c1
commit
f3d7795a1e
@ -9,10 +9,8 @@
|
||||
|
||||
import _ from 'lodash';
|
||||
import React, { FC, useEffect } from 'react';
|
||||
import { useStyles } from './styles';
|
||||
|
||||
export const MobilePageContentContainer: FC<{ hideTabBar?: boolean }> = ({ children, hideTabBar }) => {
|
||||
const { styles } = useStyles();
|
||||
const [mobileTabBarHeight, setMobileTabBarHeight] = React.useState(0);
|
||||
const [mobilePageHeader, setMobilePageHeader] = React.useState(0);
|
||||
useEffect(() => {
|
||||
@ -29,11 +27,13 @@ export const MobilePageContentContainer: FC<{ hideTabBar?: boolean }> = ({ child
|
||||
<>
|
||||
{mobilePageHeader ? <div style={{ height: mobilePageHeader }}></div> : null}
|
||||
<div
|
||||
className={`${styles.mobilePageContent} mobile-page-content`}
|
||||
className="mobile-page-content"
|
||||
data-testid="mobile-page-content"
|
||||
style={{
|
||||
height: `calc(100% - ${(mobileTabBarHeight || 0) + (mobilePageHeader || 0)}px)`,
|
||||
boxSizing: 'border-box',
|
||||
maxWidth: '100%',
|
||||
overflowX: 'hidden',
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { createStyles } from 'antd-style';
|
||||
|
||||
export const useStyles = createStyles(() => ({
|
||||
mobilePageContent: {
|
||||
maxWidth: '100%',
|
||||
overflowX: 'hidden',
|
||||
},
|
||||
}));
|
Loading…
Reference in New Issue
Block a user