diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-14 12:36:46 -0400 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-14 12:36:46 -0400 |
commit | 86bf6857e98743502fe6bc85e7de6807808c41c4 (patch) | |
tree | 551726b5b0bb4f72fa23a244e7ac6c168bdd6c92 /src | |
parent | a712bf960817a42e408c1f7663a103a454bb3239 (diff) |
Fixed some of the auto suggest stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/MetadataEntryMenu.scss | 57 | ||||
-rw-r--r-- | src/client/views/MetadataEntryMenu.tsx | 7 |
2 files changed, 61 insertions, 3 deletions
diff --git a/src/client/views/MetadataEntryMenu.scss b/src/client/views/MetadataEntryMenu.scss index 73e5b6a73..469843350 100644 --- a/src/client/views/MetadataEntryMenu.scss +++ b/src/client/views/MetadataEntryMenu.scss @@ -7,4 +7,61 @@ .metadataEntry-outerDiv { display: flex; width: 300px; +} + +.react-autosuggest__container { + position: relative; +} + +.react-autosuggest__input { + width: 240px; + height: 30px; + padding: 10px 20px; + font-family: Helvetica, sans-serif; + font-weight: 300; + font-size: 16px; + border: 1px solid #aaa; + border-radius: 4px; +} + +.react-autosuggest__input--focused { + outline: none; +} + +.react-autosuggest__input--open { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.react-autosuggest__suggestions-container { + display: none; +} + +.react-autosuggest__suggestions-container--open { + display: block; + position: fixed; + width: 280px; + border: 1px solid #aaa; + background-color: #fff; + font-family: Helvetica, sans-serif; + font-weight: 300; + font-size: 16px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + z-index: 2; +} + +.react-autosuggest__suggestions-list { + margin: 0; + padding: 0; + list-style-type: none; +} + +.react-autosuggest__suggestion { + cursor: pointer; + padding: 10px 20px; +} + +.react-autosuggest__suggestion--highlighted { + background-color: #ddd; }
\ No newline at end of file diff --git a/src/client/views/MetadataEntryMenu.tsx b/src/client/views/MetadataEntryMenu.tsx index 0c8fd3909..cb574aa96 100644 --- a/src/client/views/MetadataEntryMenu.tsx +++ b/src/client/views/MetadataEntryMenu.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import "./MetadataEntryMenu.scss"; import { observer } from 'mobx-react'; -import { observable, action, runInAction } from 'mobx'; +import { observable, action, runInAction, trace } from 'mobx'; import { KeyValueBox } from './nodes/KeyValueBox'; import { Doc } from '../../new_fields/Doc'; import * as Autosuggest from 'react-autosuggest'; @@ -20,8 +20,8 @@ export class MetadataEntryMenu extends React.Component<MetadataEntryProps>{ @observable private suggestions: string[] = []; @action - onKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => { - this._currentKey = e.target.value; + onKeyChange = (e: React.ChangeEvent, { newValue }: { newValue: string }) => { + this._currentKey = newValue; } @action @@ -102,6 +102,7 @@ export class MetadataEntryMenu extends React.Component<MetadataEntryProps>{ } render() { + trace(); return ( <div className="metadataEntry-outerDiv"> Key: |