aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search/SearchItem.tsx
diff options
context:
space:
mode:
authorMonika <monika_hedman@brown.edu>2019-07-01 15:39:48 -0400
committerMonika <monika_hedman@brown.edu>2019-07-01 15:39:48 -0400
commit6bd79baf2d9301304194d87667bb5c66c17e5298 (patch)
treeef6443c82b34bc88ce222f0e3edd63e405612e91 /src/client/views/search/SearchItem.tsx
parentc5391bf0d352f69211ba28fc263d27204d7b8dc4 (diff)
changes
Diffstat (limited to 'src/client/views/search/SearchItem.tsx')
-rw-r--r--src/client/views/search/SearchItem.tsx43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index f8a0c7b16..f4ea3ee09 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -82,7 +82,7 @@ export class SelectorContextMenu extends React.Component<SearchItemProps> {
SetupDrag(item, () => doc.col, undefined, undefined, undefined, undefined, () => SearchBox.Instance.closeSearch())}>
<FontAwesomeIcon icon={faStickyNote} />
</div>
- <a className="title" onClick={this.getOnClick(doc)}>{doc.col.title}</a>
+ <a onClick={this.getOnClick(doc)}>{doc.col.title}</a>
</div>;
})}
</div>
@@ -90,6 +90,44 @@ export class SelectorContextMenu extends React.Component<SearchItemProps> {
}
}
+export interface LinkMenuProps {
+ doc1: Doc;
+ doc2: Doc;
+}
+
+@observer
+export class LinkContextMenu extends React.Component<LinkMenuProps> {
+
+ highlightDoc = (doc: Doc) => {
+ return () => {
+ doc.libraryBrush = true;
+ };
+ }
+
+ unHighlightDoc = (doc: Doc) => {
+ return () => {
+ doc.libraryBrush = false;
+ };
+ }
+
+ getOnClick(col: Doc) {
+ return () => {
+ CollectionDockingView.Instance.AddRightSplit(col, undefined);
+ };
+ }
+
+ render() {
+ return (
+ <div className="parents">
+ <p className="contexts">Anchors:</p>
+ <div className = "collection"><a onMouseEnter = {this.highlightDoc(this.props.doc1)} onMouseLeave = {this.unHighlightDoc(this.props.doc1)} onClick = {this.getOnClick(this.props.doc1)}>Doc 1: {this.props.doc2.title}</a></div>
+ <div><a onMouseEnter = {this.highlightDoc(this.props.doc2)} onMouseLeave = {this.unHighlightDoc(this.props.doc2)} onClick = {this.getOnClick(this.props.doc2)}>Doc 2: {this.props.doc1.title}</a></div>
+ </div>
+ )
+ }
+
+}
+
@observer
export class SearchItem extends React.Component<SearchItemProps> {
@@ -244,7 +282,8 @@ export class SearchItem extends React.Component<SearchItemProps> {
</div>
</div>
<div className="searchBox-instances">
- <SelectorContextMenu {...this.props} />
+ {this.props.doc.type === DocTypes.LINK ? <LinkContextMenu doc1 = {Cast(this.props.doc.anchor1, Doc, new Doc())} doc2 = {Cast(this.props.doc.anchor2, Doc, new Doc())}/> :
+ <SelectorContextMenu {...this.props} /> }
</div>
</div>
);