From 0c066dac5eb3e7c47b708a6a5a1d95dc75f320fe Mon Sep 17 00:00:00 2001 From: madelinegr Date: Tue, 11 Jun 2019 14:10:18 -0400 Subject: making words required almost works (logic is there) --- src/client/views/search/IconBar.scss | 50 ++++++++-- src/client/views/search/IconBar.tsx | 165 +++++++++++++++++++-------------- src/client/views/search/SearchBox.scss | 14 ++- src/client/views/search/SearchBox.tsx | 20 +++- src/client/views/search/ToggleBar.scss | 4 - src/client/views/search/ToggleBar.tsx | 8 +- 6 files changed, 167 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/client/views/search/IconBar.scss b/src/client/views/search/IconBar.scss index eb7b45754..98b4e50a6 100644 --- a/src/client/views/search/IconBar.scss +++ b/src/client/views/search/IconBar.scss @@ -1,17 +1,23 @@ @import "../globalCssVariables"; -.icon-bar{ +.icon-bar { display: flex; justify-content: space-evenly; align-items: center; height: 40px; width: 100%; flex-wrap: wrap; - font-size: 2em; + // font-size: 2em; +} + +.icon-title { + color: $light-color; + text-transform: uppercase; + padding: 5px; } -.type-icon{ +.type-icon { height: 50px; width: 50px; color: $light-color; @@ -19,22 +25,50 @@ display: flex; justify-content: center; align-items: center; - // background-color: "#121721"; + -webkit-transition: all 0.2s ease-in-out; + -moz-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; + font-size: 2em; } -.type-icon.selected{ +.type-icon.selected { background-color: $alt-accent; } -.type-icon.not-selected{ +.type-icon.not-selected { background-color: transparent; } -.fontawesome-icon{ +.fontawesome-icon { height: 28px; width: 28px; } -.type-icon:hover{ +.type-icon:hover { + transform: scale(1.1); background-color: $alt-accent; + + +.filter-description { + opacity: 1; + } +} + +.type-outer { + display: flex; + flex-direction: column; + align-items: center; + width: 50px; +} + +.filter-description { + font-size: 10; + text-align: center; + height: 15px; + margin-top: 5px; + opacity: 0; + -webkit-transition: all 0.2s ease-in-out; + -moz-transition: all 0.2s ease-in-out; + -o-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; } \ No newline at end of file diff --git a/src/client/views/search/IconBar.tsx b/src/client/views/search/IconBar.tsx index bf98e1ef3..9a36e7cdf 100644 --- a/src/client/views/search/IconBar.tsx +++ b/src/client/views/search/IconBar.tsx @@ -145,80 +145,101 @@ export class IconBar extends React.Component { render() { return ( -
-
-
{ this.onClick(DocTypes.NONE) }}> - -
-
{ this.onClick(DocTypes.PDF) }}> - -
-
{ this.onClick(DocTypes.HIST) }}> - -
-
{ this.onClick(DocTypes.COL) }}> - -
-
{ this.onClick(DocTypes.IMG) }}> - -
-
{ this.onClick(DocTypes.VID) }}> - -
-
{ this.onClick(DocTypes.WEB) }}> - -
-
{ this.onClick(DocTypes.LINK) }}> - -
-
{ this.onClick(DocTypes.AUDIO) }}> - -
-
{ this.onClick(DocTypes.TEXT) }}> - +
+
Filter by type of node
+
+
+
{ this.onClick(DocTypes.NONE) }}> + +
+
Clear
+
+
+
{ this.onClick(DocTypes.PDF) }}> + +
+
PDF
+
+
+
{ this.onClick(DocTypes.HIST) }}> + +
+
Histogram
+
+
+
{ this.onClick(DocTypes.COL) }}> + +
+
Collection
+
+
+
{ this.onClick(DocTypes.IMG) }}> + +
+
Image
+
+
+
{ this.onClick(DocTypes.VID) }}> + +
+
Video
+
+
+
{ this.onClick(DocTypes.WEB) }}> + +
+
Web
+
+
+
{ this.onClick(DocTypes.LINK) }}> + +
+
Link
+
+
+
{ this.onClick(DocTypes.AUDIO) }}> + +
+
Audio
+
+
+
{ this.onClick(DocTypes.TEXT) }}> + +
+
Text
+
-
) } } diff --git a/src/client/views/search/SearchBox.scss b/src/client/views/search/SearchBox.scss index 4ce40614f..48c8f4af1 100644 --- a/src/client/views/search/SearchBox.scss +++ b/src/client/views/search/SearchBox.scss @@ -57,10 +57,6 @@ height: 40px; } -// #option { -// height: 20px; -// } - .searchBox-results { top: 300px; display: flex; @@ -68,8 +64,16 @@ margin-right: 72px; } +.filter-collection{ + height: 20px; +} + +.where-in-doc{ + height: 20px; +} + .type-of-node{ - height: 60px; + height: 90px; } .required-words{ diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 329643464..67122b320 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -27,6 +27,7 @@ import { IconBar } from './IconBar'; @observer export class SearchBox extends React.Component { @observable _searchString: string = ""; + //if true, any keywords can be used. if false, all keywords are required. @observable _wordStatus: boolean = true; @observable _icons: string[] = []; @observable private _open: boolean = false; @@ -42,6 +43,20 @@ export class SearchBox extends React.Component { @action submitSearch = async () => { let query = this._searchString; + + if(!this._wordStatus){ + let oldWords = query.split(" "); + let newWords: string[] = []; + console.log(oldWords) + oldWords.forEach(word => { + let newWrd = "+" + word; + newWords.push(newWrd); + }) + console.log(newWords) + + query = newWords.join(" ") + } + //gets json result into a list of documents that can be used const results = await this.getResults(query); @@ -185,8 +200,9 @@ export class SearchBox extends React.Component { return toReturn; } - handleWordQueryChange = (value: boolean) => { - this._wordStatus = value; + //if true, any keywords can be used. if false, all keywords are required. + handleWordQueryChange = () => { + this._wordStatus = !this._wordStatus; } @action.bound diff --git a/src/client/views/search/ToggleBar.scss b/src/client/views/search/ToggleBar.scss index 601b9a1dc..cccbf30fc 100644 --- a/src/client/views/search/ToggleBar.scss +++ b/src/client/views/search/ToggleBar.scss @@ -1,9 +1,5 @@ @import "../globalCssVariables"; -.toggle{ - -} - .toggle-title{ display: flex; align-items: center; diff --git a/src/client/views/search/ToggleBar.tsx b/src/client/views/search/ToggleBar.tsx index 2fc9c0040..5ede368d6 100644 --- a/src/client/views/search/ToggleBar.tsx +++ b/src/client/views/search/ToggleBar.tsx @@ -8,7 +8,8 @@ import * as anime from 'animejs'; export interface ToggleBarProps { //false = right, true = left // status: boolean; - changeStatus(value: boolean): void; + changeStatus(): void; + // changeStatus(value: boolean): void; optionOne: string; optionTwo: string; } @@ -53,8 +54,9 @@ export class ToggleBar extends React.Component{ @action.bound onclick() { - this._status = !this._status; - this.props.changeStatus(this._status); + // this._status = !this._status; + // this.props.changeStatus(this._status); + this.props.changeStatus(); this.timeline.play(); this.timeline.reverse(); } -- cgit v1.2.3-70-g09d2