Skip to content
Snippets Groups Projects
CommentComponent.js 901 B
Newer Older
chris's avatar
chris committed
import React, {
  useContext,
  useState,
  useEffect,
  useMemo,
  Fragment
} from "react";
import styled from "styled-components";
chris's avatar
chris committed
import { WaxContext } from "wax-prosemirror-core/src/ioc-react";
import { DocumentHelpers } from "wax-prosemirror-utilities";
chris's avatar
chris committed
const CommentComponentStyled = styled.div`
  width: 100px;
  height: 100px;
  background: black;
  display: flex;
  flex-direction: row;
`;
chris's avatar
chris committed
export default () => {
  const { view: { main } } = useContext(WaxContext);
  const [comments, setComments] = useState([]);
  useEffect(
    () => {
      setComments(updateComments(main));
    },

    [JSON.stringify(updateComments(main))]
  );

  const CommentComponent = useMemo(
    () => <CommentComponentStyled view={main} />,
    [comments]
  );
  return <Fragment>{CommentComponent}</Fragment>;
chris's avatar
chris committed
const updateComments = view => {
  if (view) {
    // TODO find comments
  }
  return [];
};