Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(components/ModalPluginList): convert ModalPluginList class to Functional Component #447

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions src/components/ModalPluginList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading