React/Preact compatibility cleanup

This commit is contained in:
Rainer Simon 2021-06-11 12:03:44 +02:00
parent 7faceb41e4
commit a9046c8dfb
11 changed files with 13 additions and 15 deletions

View File

@ -1,4 +1,4 @@
import React from 'preact/compat'; import React from 'react';
/** /**
* Icon from IcoFont https://icofont.com/, licensed under the CC BY 4.0 license. * Icon from IcoFont https://icofont.com/, licensed under the CC BY 4.0 license.

View File

@ -1,5 +1,4 @@
import React from 'preact/compat'; import React, { useState, useRef, useEffect } from 'react';
import { useState, useRef, useEffect } from 'preact/hooks';
import { getWidget, DEFAULT_WIDGETS } from './widgets'; import { getWidget, DEFAULT_WIDGETS } from './widgets';
import { TrashIcon } from '../Icons'; import { TrashIcon } from '../Icons';
import setPosition from './setPosition'; import setPosition from './setPosition';

View File

@ -1,4 +1,4 @@
import { useEffect } from 'preact/hooks'; import { useEffect } from 'react';
export default function useClickOutside(ref, callback) { export default function useClickOutside(ref, callback) {

View File

@ -1,4 +1,4 @@
import React, { Component } from 'preact/compat'; import React, { Component } from 'react';
export default class WrappedWidget extends Component { export default class WrappedWidget extends Component {

View File

@ -1,5 +1,4 @@
import React from 'preact/compat'; import React, { useState } from 'react';
import { useState } from 'preact/hooks';
import TimeAgo from 'timeago-react'; import TimeAgo from 'timeago-react';
import DropdownMenu from './DropdownMenu'; import DropdownMenu from './DropdownMenu';
import TextEntryField from './TextEntryField'; import TextEntryField from './TextEntryField';

View File

@ -1,4 +1,4 @@
import React from 'preact/compat'; import React from 'react';
import Comment from './Comment'; import Comment from './Comment';
import TextEntryField from './TextEntryField'; import TextEntryField from './TextEntryField';
import i18n from '../../../i18n'; import i18n from '../../../i18n';

View File

@ -1,5 +1,4 @@
import React from 'preact/compat'; import React, { useRef } from 'react';
import { useRef } from 'preact/hooks';
import useClickOutside from '../../useClickOutside'; import useClickOutside from '../../useClickOutside';
import i18n from '../../../i18n'; import i18n from '../../../i18n';

View File

@ -1,4 +1,4 @@
import React from 'preact/compat'; import React from 'react';
import Select from 'react-select'; import Select from 'react-select';
export const PURPOSES = [ export const PURPOSES = [

View File

@ -1,4 +1,4 @@
import React, { Component } from 'preact/compat'; import React, { Component } from 'react';
import TextareaAutosize from 'react-autosize-textarea'; import TextareaAutosize from 'react-autosize-textarea';
import i18n from '../../../i18n'; import i18n from '../../../i18n';

View File

@ -1,14 +1,16 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom';
import CommentWidget from './comment/CommentWidget' import CommentWidget from './comment/CommentWidget'
import TagWidget from './tag/TagWidget'; import TagWidget from './tag/TagWidget';
import WrappedWidget from './WrappedWidget'; import WrappedWidget from './WrappedWidget';
/** /**
* We'll add React to the global window, so that * We'll add React and ReactDOM to the global window, so that
* plugins can use it without re-bundling. Also, * plugins can use it without re-bundling. Also,
* without this, hooks won't work! * without this, hooks won't work!
*/ */
window.React = React; window.React = React;
window.ReactDOM = ReactDOM;
/** Standard widgets included by default **/ /** Standard widgets included by default **/
const BUILTIN_WIDGETS = { const BUILTIN_WIDGETS = {

View File

@ -1,5 +1,4 @@
import React from 'preact/compat'; import React, { useState } from 'react';
import { useState } from 'preact/hooks';
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import { CloseIcon } from '../../../Icons'; import { CloseIcon } from '../../../Icons';
import i18n from '../../../i18n'; import i18n from '../../../i18n';