From a192b04135e2ef88fb34fc61292dde5a22e7e9f5 Mon Sep 17 00:00:00 2001 From: HarelM Date: Fri, 22 Dec 2023 14:44:16 +0200 Subject: [PATCH] Migration of more components --- ...erEditorGroup.jsx => LayerEditorGroup.tsx} | 22 +++++++++---------- ...{LayerListGroup.jsx => LayerListGroup.tsx} | 19 ++++++++-------- 2 files changed, 20 insertions(+), 21 deletions(-) rename src/components/{LayerEditorGroup.jsx => LayerEditorGroup.tsx} (72%) rename src/components/{LayerListGroup.jsx => LayerListGroup.tsx} (63%) diff --git a/src/components/LayerEditorGroup.jsx b/src/components/LayerEditorGroup.tsx similarity index 72% rename from src/components/LayerEditorGroup.jsx rename to src/components/LayerEditorGroup.tsx index 652aba44..888f8d9b 100644 --- a/src/components/LayerEditorGroup.jsx +++ b/src/components/LayerEditorGroup.tsx @@ -1,5 +1,4 @@ import React from 'react' -import PropTypes from 'prop-types' import Icon from '@mdi/react' import { mdiMenuDown, @@ -13,21 +12,22 @@ import { } from 'react-accessible-accordion'; -export default class LayerEditorGroup extends React.Component { - static propTypes = { - "id": PropTypes.string, - "data-wd-key": PropTypes.string, - title: PropTypes.string.isRequired, - isActive: PropTypes.bool.isRequired, - children: PropTypes.element.isRequired, - onActiveToggle: PropTypes.func.isRequired - } +type LayerEditorGroupProps = { + "id"?: string + "data-wd-key"?: string + title: string + isActive: boolean + children: React.ReactElement + onActiveToggle(...args: unknown[]): unknown +}; + +export default class LayerEditorGroup extends React.Component { render() { return this.props.onActiveToggle(!this.props.isActive)} + onClick={_e => this.props.onActiveToggle(!this.props.isActive)} > {this.props.title} diff --git a/src/components/LayerListGroup.jsx b/src/components/LayerListGroup.tsx similarity index 63% rename from src/components/LayerListGroup.jsx rename to src/components/LayerListGroup.tsx index 9d62f075..b362b8ea 100644 --- a/src/components/LayerListGroup.jsx +++ b/src/components/LayerListGroup.tsx @@ -1,21 +1,20 @@ import React from 'react' -import PropTypes from 'prop-types' import Collapser from './Collapser' -export default class LayerListGroup extends React.Component { - static propTypes = { - title: PropTypes.string.isRequired, - "data-wd-key": PropTypes.string, - isActive: PropTypes.bool.isRequired, - onActiveToggle: PropTypes.func.isRequired, - 'aria-controls': PropTypes.string, - } +type LayerListGroupProps = { + title: string + "data-wd-key"?: string + isActive: boolean + onActiveToggle(...args: unknown[]): unknown + 'aria-controls'?: string +}; +export default class LayerListGroup extends React.Component { render() { return
  • this.props.onActiveToggle(!this.props.isActive)} + onClick={_e => this.props.onActiveToggle(!this.props.isActive)} >