chore: image custom params
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { ParamsSchema } from '@/pages/playground/config/types';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import React from 'react';
|
||||
import componentsMap from './config/components';
|
||||
|
||||
const FieldComponent: React.FC<ParamsSchema> = (props) => {
|
||||
const intl = useIntl();
|
||||
const { type, label, attrs, style, ...rest } = props;
|
||||
return React.createElement(componentsMap[type], {
|
||||
...rest,
|
||||
...attrs,
|
||||
style: { ...style, width: '100%' },
|
||||
label: label.isLocalized
|
||||
? intl.formatMessage({ id: label.text })
|
||||
: label.text
|
||||
});
|
||||
};
|
||||
|
||||
export default React.memo(FieldComponent);
|
||||
Reference in New Issue
Block a user