From b5fac34cf22bcb47854c00671848e25b7ee9d37f Mon Sep 17 00:00:00 2001 From: Monika Hedman Date: Wed, 8 May 2019 20:38:02 -0400 Subject: issues with icon --- src/client/views/SearchBox.scss | 50 ++++++++++++++++++++--------------------- src/client/views/SearchBox.tsx | 24 +++++++++++++++----- src/client/views/SearchItem.tsx | 36 ++++++++++++++++++++++++++--- 3 files changed, 76 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/client/views/SearchBox.scss b/src/client/views/SearchBox.scss index f4fc0029e..792d6dd3c 100644 --- a/src/client/views/SearchBox.scss +++ b/src/client/views/SearchBox.scss @@ -68,32 +68,32 @@ top: 300px; display: flex; flex-direction: column; -} -.search-item { - width: 500px; - height: 50px; - background: $light-color-secondary; - display: flex; - justify-content: left; - align-items: center; - transition: all 0.1s; - border-width: 0.11px; - border-style: none; - border-color: $intermediate-color; - border-bottom-style: solid; - padding: 10px; - white-space: nowrap; - font-size: 13px; -} + .search-item { + width: 500px; + height: 50px; + background: $light-color-secondary; + display: flex; + justify-content: space-between; + align-items: center; + transition: all 0.1s; + border-width: 0.11px; + border-style: none; + border-color: $intermediate-color; + border-bottom-style: solid; + padding: 10px; + white-space: nowrap; + font-size: 13px; + } -.search-item:hover { - transition: all 0.1s; - background: $lighter-alt-accent; -} + .search-item:hover { + transition: all 0.1s; + background: $lighter-alt-accent; + } -.search-title { - text-transform: uppercase; - text-align: left; - width: 8vw; + .search-title { + text-transform: uppercase; + text-align: left; + width: 8vw; + } } \ No newline at end of file diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx index 827d468df..7dd1af4e7 100644 --- a/src/client/views/SearchBox.tsx +++ b/src/client/views/SearchBox.tsx @@ -67,7 +67,7 @@ export class SearchBox extends React.Component { } @action - handleClick = (e: Event): void => { + handleClickFilter = (e: Event): void => { var className = (e.target as any).className; var id = (e.target as any).id; if (className !== "filter-button" && className !== "filter-form") { @@ -76,16 +76,28 @@ export class SearchBox extends React.Component { } + @action + handleClickResults = (e: Event): void => { + var className = (e.target as any).className; + var id = (e.target as any).id; + if (id !== "result") { + this._resultsOpen = false; + } + + } + componentWillMount() { - document.addEventListener('mousedown', this.handleClick, false); + document.addEventListener('mousedown', this.handleClickFilter, false); + document.addEventListener('mousedown', this.handleClickResults, false); } componentWillUnmount() { - document.removeEventListener('mousedown', this.handleClick, false); + document.removeEventListener('mousedown', this.handleClickFilter, false); + document.removeEventListener('mousedown', this.handleClickResults, false); } @action - toggleDisplay = () => { + toggleFilterDisplay = () => { this._open = !this._open; } @@ -101,9 +113,9 @@ export class SearchBox extends React.Component {
- +
-
+
{this._results.map(result => )}
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 { 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 : "

Error loading icon data

"; } + + + 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 ; } render() { return ( -
-
{this.props.doc.title}
+
+
title: {this.props.doc.title}
+
Type: {this.props.doc.layout}
+ {/*
{SearchItem.DocumentIcon(this.layout)}
*/}
); } -- cgit v1.2.3-70-g09d2