From b5fac34cf22bcb47854c00671848e25b7ee9d37f Mon Sep 17 00:00:00 2001
From: Monika Hedman <monika_hedman@brown.edu>
Date: Wed, 8 May 2019 20:38:02 -0400
Subject: issues with icon

---
 src/client/views/SearchItem.tsx | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

(limited to 'src/client/views/SearchItem.tsx')

diff --git a/src/client/views/SearchItem.tsx b/src/client/views/SearchItem.tsx
index 81da7ebd2..539d6b5e5 100644
--- a/src/client/views/SearchItem.tsx
+++ b/src/client/views/SearchItem.tsx
@@ -1,21 +1,51 @@
 import React = require("react");
 import { Doc } from "../../new_fields/Doc";
 import { DocumentManager } from "../util/DocumentManager";
+import { library } from '@fortawesome/fontawesome-svg-core';
+import { faCaretUp, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Cast } from "../../new_fields/Types";
+import { FieldView, FieldViewProps } from './nodes/FieldView';
+import { computed } from "mobx";
+import { IconField } from "../../new_fields/IconField";
+
 
 export interface SearchProps {
     doc: Doc;
 }
 
+library.add(faCaretUp);
+library.add(faObjectGroup);
+library.add(faStickyNote);
+library.add(faFilePdf);
+library.add(faFilm);
+
 export class SearchItem extends React.Component<SearchProps> {
 
     onClick = () => {
-        DocumentManager.Instance.jumpToDocument(this.props.doc)
+        DocumentManager.Instance.jumpToDocument(this.props.doc);
+    }
+
+    //needs help
+    // @computed get layout(): string { const field = Cast(this.props.doc[fieldKey], IconField); return field ? field.icon : "<p>Error loading icon data</p>"; }
+
+
+    public static DocumentIcon(layout: string) {
+        let button = layout.indexOf("PDFBox") !== -1 ? faFilePdf :
+            layout.indexOf("ImageBox") !== -1 ? faImage :
+                layout.indexOf("Formatted") !== -1 ? faStickyNote :
+                    layout.indexOf("Video") !== -1 ? faFilm :
+                        layout.indexOf("Collection") !== -1 ? faObjectGroup :
+                            faCaretUp;
+        return <FontAwesomeIcon icon={button} className="documentView-minimizedIcon" />;
     }
 
     render() {
         return (
-            <div className="search-item" onClick={this.onClick}>
-                <div className="search-title">{this.props.doc.title}</div>
+            <div className="search-item" id="result" onClick={this.onClick}>
+                <div className="search-title" id="result" >title: {this.props.doc.title}</div>
+                <div className="search-type" id="result" >Type: {this.props.doc.layout}</div>
+                {/* <div className="search-type" >{SearchItem.DocumentIcon(this.layout)}</div> */}
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2

