mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
feat(blocksAntd): refactor Alert with visible icon default
This commit is contained in:
parent
729dd42cae
commit
37f7c72375
@ -20,25 +20,30 @@ import { blockDefaultProps } from '@lowdefy/block-tools';
|
||||
|
||||
import Icon from '../Icon/Icon';
|
||||
|
||||
const AlertBlock = ({ blockId, methods, properties }) => (
|
||||
<Alert
|
||||
afterClose={() => methods.callAction({ action: 'afterClose' })}
|
||||
banner={properties.banner}
|
||||
closable={properties.closable}
|
||||
closeText={properties.closeText}
|
||||
description={properties.description}
|
||||
id={blockId}
|
||||
message={properties.message}
|
||||
onClose={() => methods.callAction({ action: 'onClose' })}
|
||||
showIcon={!!properties.icon}
|
||||
type={properties.type}
|
||||
icon={
|
||||
properties.icon && (
|
||||
<Icon blockId={`${blockId}_icon`} methods={methods} properties={properties.icon} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
const AlertBlock = ({ blockId, methods, properties }) => {
|
||||
const additionalProps = {};
|
||||
if (properties.icon) {
|
||||
additionalProps.icon = (
|
||||
<Icon blockId={`${blockId}_icon`} methods={methods} properties={properties.icon} />
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Alert
|
||||
afterClose={() => methods.callAction({ action: 'afterClose' })}
|
||||
banner={properties.banner}
|
||||
closable={properties.closable}
|
||||
closeText={properties.closeText}
|
||||
description={properties.description}
|
||||
id={blockId}
|
||||
message={properties.message || <div style={{ height: '1.5175em' }}></div>}
|
||||
description={properties.description}
|
||||
onClose={() => methods.callAction({ action: 'onClose' })}
|
||||
showIcon={properties.showIcon === false ? false : true}
|
||||
type={properties.type}
|
||||
{...additionalProps}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
AlertBlock.defaultProps = blockDefaultProps;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user