mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
refactor: code improve
This commit is contained in:
parent
7561db0fa0
commit
5f997963a0
@ -103,8 +103,7 @@ BlockModel.registerFlow({
|
||||
};
|
||||
},
|
||||
handler(ctx, params) {
|
||||
ctx.model.setProps('heightMode', params.heightMode);
|
||||
ctx.model.setProps('height', params.height);
|
||||
ctx.model.setDecoratorProps({ heightMode: params.heightMode, height: params.height });
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -14,10 +14,18 @@ import { useTranslation } from 'react-i18next';
|
||||
import { NAMESPACE_UI_SCHEMA } from '../../../i18n/constant';
|
||||
import { MarkdownReadPretty } from '../fields/EditableField/MarkdownEditableFieldModel';
|
||||
|
||||
const useBlockHeight = ({ height, heightMode }) => {
|
||||
if (heightMode !== 'specifyValue') {
|
||||
return null;
|
||||
}
|
||||
return height;
|
||||
};
|
||||
|
||||
export const BlockItemCard = (props) => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const { title: blockTitle, description, children } = props;
|
||||
const height = useBlockHeight(props);
|
||||
const title = (blockTitle || description) && (
|
||||
<div style={{ padding: '8px 0px 8px' }}>
|
||||
<span> {t(blockTitle, { ns: NAMESPACE_UI_SCHEMA })}</span>
|
||||
@ -38,7 +46,7 @@ export const BlockItemCard = (props) => {
|
||||
return (
|
||||
<Card
|
||||
title={title}
|
||||
style={{ display: 'flex', flexDirection: 'column', height: '100%' }}
|
||||
style={{ display: 'flex', flexDirection: 'column', height: height }}
|
||||
styles={{
|
||||
body: { flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden' },
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user