diff --git a/web/app/components/list-comments/list-comments.jsx b/web/app/components/list-comments/list-comments.jsx index e05febaa..824f7f6e 100644 --- a/web/app/components/list-comments/list-comments.jsx +++ b/web/app/components/list-comments/list-comments.jsx @@ -1,20 +1,18 @@ /** @jsx h */ -import { h, Component } from 'preact'; +import { h } from 'preact'; import { NODE_ID } from 'common/constants'; import Comment from 'components/comment'; -export default class ListComments extends Component { - render({ comments = [] }) { - return ( -
-
- {comments.map(comment => ( - - ))} -
-
- ); - } -} +const ListComments = ({ comments = [] }) => ( +
+
+ {comments.map(comment => ( + + ))} +
+
+); + +export default ListComments; diff --git a/web/app/components/preloader/preloader.jsx b/web/app/components/preloader/preloader.jsx index bf5fc8c4..89b2ba61 100644 --- a/web/app/components/preloader/preloader.jsx +++ b/web/app/components/preloader/preloader.jsx @@ -1,14 +1,12 @@ /** @jsx h */ -import { h, Component } from 'preact'; +import { h } from 'preact'; -export default class Preloader extends Component { - render(props) { - return ( -
-
-
-
-
- ); - } -} +const Preloader = props => ( +
+
+
+
+
+); + +export default Preloader; diff --git a/web/app/components/user-info/last-comments-list.jsx b/web/app/components/user-info/last-comments-list.jsx new file mode 100644 index 00000000..4fef9a5e --- /dev/null +++ b/web/app/components/user-info/last-comments-list.jsx @@ -0,0 +1,15 @@ +/** @jsx h */ +import { h } from 'preact'; + +import Comment from 'components/comment'; +import Preloader from 'components/preloader'; + +const LastCommentsList = ({ comments, isLoading }) => { + if (isLoading) { + return ; + } + + return
{comments.map(comment => )}
; +}; + +export default LastCommentsList; diff --git a/web/app/components/user-info/user-info.jsx b/web/app/components/user-info/user-info.jsx index c5ae8268..7b46a08f 100644 --- a/web/app/components/user-info/user-info.jsx +++ b/web/app/components/user-info/user-info.jsx @@ -4,10 +4,9 @@ import { h, Component } from 'preact'; import api from 'common/api'; import { getHandleClickProps } from 'common/accessibility'; -import Comment from 'components/comment'; -import Preloader from 'components/preloader'; +import LastCommentsList from './last-comments-list'; -export default class UserInfo extends Component { +class UserInfo extends Component { constructor(props) { super(props); @@ -39,18 +38,14 @@ export default class UserInfo extends Component {

Last comments by {name}

{id}

- {isLoading && } + - {!isLoading && ( -
{comments.map(comment => )}
- )} - -
- - Close - -
+ + Close +
); } } + +export default UserInfo;