From 33809739a0a24a256d6a1b30bf237fc8bd749db3 Mon Sep 17 00:00:00 2001
From: madelinegr <laura_wilson@brown.edu>
Date: Tue, 26 Feb 2019 18:59:56 -0500
Subject: set up infrastructure for deletedoc

---
 src/client/views/collections/CollectionTreeView.tsx | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'src/client/views/collections/CollectionTreeView.tsx')

diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 924312d06..b075737d2 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -14,6 +14,7 @@ import { COLLECTION_BORDER_WIDTH } from "./CollectionView";
 
 export interface TreeViewProps {
     document: Document;
+    deleteDoc: (doc: Document) => void;
 }
 
 export enum BulletType {
@@ -31,6 +32,10 @@ class TreeView extends React.Component<TreeViewProps> {
     @observable
     collapsed: boolean = false;
 
+    delete() {
+        this.props.deleteDoc;
+    }
+
     renderBullet(type: BulletType) {
         let onClicked = action(() => this.collapsed = !this.collapsed);
 
@@ -55,7 +60,7 @@ class TreeView extends React.Component<TreeViewProps> {
             return <div key={this.props.document.Id}></div>;
         }
 
-        return <EditableView contents={title.Data}
+        return <div className="docContainer"> <EditableView contents={title.Data}
             height={36} GetValue={() => {
                 let title = this.props.document.GetT<TextField>(KeyStore.Title, TextField);
                 if (title && title !== "<Waiting>")
@@ -65,6 +70,8 @@ class TreeView extends React.Component<TreeViewProps> {
                 this.props.document.SetData(KeyStore.Title, value, TextField);
                 return true;
             }} />
+            <div className="delete-button" onClick={this.delete}>x</div>
+        </div >
     }
 
     render() {
@@ -80,7 +87,7 @@ class TreeView extends React.Component<TreeViewProps> {
 
             // render all children elements
             let childrenElement = (children.Data.map(value =>
-                <TreeView document={value} />)
+                <TreeView document={value} deleteDoc={() => console.log("test")} />)
             )
 
             // if uncollapsed, then add the children elements
@@ -129,7 +136,7 @@ export class CollectionTreeView extends CollectionViewBase {
         var children = this.props.Document.GetT<ListField<Document>>(KeyStore.Data, ListField);
         let childrenElement = !children || children === FieldWaiting ? (null) :
             (children.Data.map(value =>
-                <TreeView document={value} />)
+                <TreeView document={value} deleteDoc={() => console.log("test")} />)
             )
 
         return (
-- 
cgit v1.2.3-70-g09d2

