Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(components/ModalPluginList): convert ModalPluginList to Func…
Browse files Browse the repository at this point in the history
…tional Component
gabrielsiilva committed Oct 10, 2024
1 parent 1fde26a commit 9437923
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions src/components/ModalPluginList.js
Original file line number Diff line number Diff line change
@@ -4,37 +4,35 @@
* License: MIT
*/

import React, { Component } from "react";

import React from "react";
import { ModalBody } from "backstage-modal";
import ModalPluginItem from "./ModalPluginItem";

export default class ModalPluginList extends Component {
constructor(props) {
super(props);
this.modalClose = this.modalClose.bind(this);
this.onChange = this.onChange.bind(this);
}
const ModalPluginList = ({
toggleModalVisibility,
plugins,
onChange,
editorState
}) => {
const modalClose = () => {
toggleModalVisibility();
};

modalClose() {
this.props.toggleModalVisibility();
}
const handleChange = (...args) => {
toggleModalVisibility();
onChange(...args);
};

onChange() {
this.props.toggleModalVisibility();
this.props.onChange(...arguments);
}
return (
<ModalBody>
<ModalPluginItem
toggleModalVisibility={modalClose}
plugins={plugins}
onChange={handleChange}
editorState={editorState}
/>
</ModalBody>
);
};

render() {
return (
<ModalBody>
<ModalPluginItem
toggleModalVisibility={this.modalClose}
plugins={this.props.plugins}
onChange={this.onChange}
editorState={this.props.editorState}
/>
</ModalBody>
);
}
}
export default ModalPluginList;

0 comments on commit 9437923

Please sign in to comment.