From 94379236a4fc68f7fb87145bc9e77ef7b178ac5c Mon Sep 17 00:00:00 2001 From: gabsilva Date: Thu, 10 Oct 2024 11:54:14 -0300 Subject: [PATCH] refactor(components/ModalPluginList): convert ModalPluginList to Functional Component --- src/components/ModalPluginList.js | 54 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/components/ModalPluginList.js b/src/components/ModalPluginList.js index 47692533..a24aaff4 100644 --- a/src/components/ModalPluginList.js +++ b/src/components/ModalPluginList.js @@ -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 ( + + + + ); +}; - render() { - return ( - - - - ); - } -} +export default ModalPluginList;