refactor: replace 'preact' with 'react' (#1048)

This commit is contained in:
Aman Harwara
2022-05-30 12:42:52 +05:30
committed by GitHub
parent e74b4953ea
commit 8c368dd96b
231 changed files with 4794 additions and 4302 deletions

View File

@@ -1,45 +1,27 @@
import { WebApplication } from '@/UIModels/Application'
import { SNComponent } from '@standardnotes/snjs'
import { Component } from 'preact'
import { findDOMNode, unmountComponentAtNode } from 'preact/compat'
import { Component } from 'react'
interface Props {
application: WebApplication
callback: (approved: boolean) => void
dismiss: () => void
component: SNComponent
permissionsString: string
}
export class PermissionsModal extends Component<Props> {
getElement(): Element | null {
return findDOMNode(this)
}
dismiss = () => {
const elem = this.getElement()
if (!elem) {
return
}
const parent = elem.parentElement
if (!parent) {
return
}
parent.remove()
unmountComponentAtNode(parent)
}
class PermissionsModal extends Component<Props> {
accept = () => {
this.props.callback(true)
this.dismiss()
this.props.dismiss()
}
deny = () => {
this.props.callback(false)
this.dismiss()
this.props.dismiss()
}
render() {
override render() {
return (
<div className="sk-modal">
<div onClick={this.deny} className="sk-modal-background" />
@@ -88,3 +70,5 @@ export class PermissionsModal extends Component<Props> {
)
}
}
export default PermissionsModal