refactor: replace 'preact' with 'react' (#1048)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user