diff --git a/package.json b/package.json index 7ab4272..138f3ac 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,6 @@ "version": "0.1.0", "private": true, "dependencies": { - "@blueprintjs/core": "^1.19.0", - "@blueprintjs/table": "^1.16.0", "@types/es6-shim": "^0.31.34", "@types/jest": "^19.2.4", "@types/lodash": "^4.14.66", diff --git a/src/App.test.tsx b/src/App.test.tsx index 2b4da0b..791960a 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import App from './App'; +import { App } from './App'; it('renders without crashing', () => { const div = document.createElement('div'); diff --git a/src/App.tsx b/src/App.tsx index 539e447..fb4c39a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,24 +1,21 @@ import * as React from 'react'; -import LexEditor from './LexComponents'; -// import { Table } from '@blueprintjs/table'; -// const logo = require('./logo.svg'); +import { LexEditor } from './LexComponents'; +import { Header, Icon, Segment } from 'semantic-ui-react'; -class App extends React.Component<{}, null> { +export class App extends React.Component<{}, null> { render() { return (
- + +
+ + + Freespeech Lexicon Editor + +
+
); } } - -export default App; diff --git a/src/LexComponents.tsx b/src/LexComponents.tsx index 5d59642..f47c674 100644 --- a/src/LexComponents.tsx +++ b/src/LexComponents.tsx @@ -1,15 +1,15 @@ import * as React from 'react'; import * as _ from 'lodash'; -// import { -// FocusStyleManager, -// } from '@blueprintjs/core'; -import { Image,Input } from 'semantic-ui-react'; +import { + Image, + Input, + Dropdown, + Card, +} from 'semantic-ui-react'; import * as XML from 'xml2js'; import { LexSingleInput } from './LexInputComponents'; const { Flex, Box } = require('reflexbox'); -// FocusStyleManager.onlyShowFocusOnTabs(); - interface LexEditorProps { fileName: RequestInfo; } @@ -31,7 +31,7 @@ const fieldMetaMap = { 'lang': { lens: '$.id', type: 'select' }, }; -class LexEditor extends React.Component { +export class LexEditor extends React.Component { lexData: any; allEntries: any; selectFields: any; @@ -99,46 +99,39 @@ class LexEditor extends React.Component { class LexSearch extends React.Component { searchType: String = 'label'; - searchValue: String = ''; + searchValue: String = 'just'; public render() { + let dropOptions = _.keys(fieldMetaMap).map((k, i, c) => { + return { key: i, value: k, text: _.capitalize(k) }; + }); return ( - -
this.handleTypeChange(e)} - > - -
-
- - this.handleLookup(e)} - /> -
-
+
+ this.handleChange(d, true)} + defaultValue={dropOptions[0].value} + compact={true} + selection={true} + /> + this.handleChange(d, false)} + /> +
); } - private handleLookup(e: any) { - this.searchValue = e.target.value; + private handleChange(e: any, t: boolean) { + if (t) { + this.searchType = e.value; + } else { + this.searchValue = e.value; + } this.props.handleOnSearch({ - searchType: this.searchType - , searchValue: this.searchValue - }); - } - - private handleTypeChange(e: any) { - this.searchType = e.target.value; - this.props.handleOnSearch({ - searchType: this.searchType - , searchValue: this.searchValue + searchType: this.searchType, + searchValue: this.searchValue }); } } @@ -146,14 +139,9 @@ class LexSearch extends React.Component { function selectMode(props: any) { if (props.searchText === '') { return ( -
-
- -
-

Empty

-
- Type something in the searchbar. -
+
+

Empty

+ Type something in the searchbar.
); } else { @@ -183,7 +171,7 @@ function selectMode(props: any) { function LexMatches(props: any) { return ( - + {selectMode(props)} ); @@ -206,11 +194,11 @@ class LexEdit extends React.Component { ); @@ -219,8 +207,7 @@ class LexEdit extends React.Component {