mirror of
https://github.com/maputnik/editor.git
synced 2025-12-09 07:40:01 +00:00
Migration of jsx files to tsx 2 (#850)
This is to continue the work of migrating all the jsx files into tsx files. The MO is basically described here: #848. About 7 files to go...
This commit is contained in:
@@ -15,21 +15,19 @@ const typeMap = {
|
||||
formatted: () => Block,
|
||||
};
|
||||
|
||||
type SpecFieldProps = InputFieldSpecProps & {
|
||||
export type SpecFieldProps = InputFieldSpecProps & {
|
||||
name?: string
|
||||
};
|
||||
|
||||
export default class SpecField extends React.Component<SpecFieldProps> {
|
||||
render() {
|
||||
const {props} = this;
|
||||
const fieldType = this.props.fieldSpec?.type;
|
||||
|
||||
const fieldType = props.fieldSpec.type;
|
||||
|
||||
const typeBlockFn = typeMap[fieldType];
|
||||
const typeBlockFn = typeMap[fieldType!];
|
||||
|
||||
let TypeBlock;
|
||||
if (typeBlockFn) {
|
||||
TypeBlock = typeBlockFn(props);
|
||||
TypeBlock = typeBlockFn(this.props);
|
||||
}
|
||||
else {
|
||||
console.warn("No such type for '%s'", fieldType);
|
||||
@@ -37,11 +35,11 @@ export default class SpecField extends React.Component<SpecFieldProps> {
|
||||
}
|
||||
|
||||
return <TypeBlock
|
||||
label={props.label}
|
||||
action={props.action}
|
||||
label={this.props.label}
|
||||
action={this.props.action}
|
||||
fieldSpec={this.props.fieldSpec}
|
||||
>
|
||||
<InputSpec {...props} />
|
||||
<InputSpec {...this.props} />
|
||||
</TypeBlock>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user