From 0141d1f9f4c7ca1755e0a5da908e9d27cf7aa0e1 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sun, 10 Dec 2017 00:41:32 +0100 Subject: Add presentation search component --- package.json | 1 + src/client/react/App.js | 15 ++++++++++++++ .../react/components/presentational/Search.js | 24 ++++++++++++++++++++++ src/client/react/index.js | 3 ++- 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/client/react/App.js create mode 100644 src/client/react/components/presentational/Search.js diff --git a/package.json b/package.json index 95337bb..5b09abd 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "left-pad": "^1.1.1", "lodash": "^4.15.0", "morgan": "~1.7.0", + "prop-types": "^15.6.0", "react": "^16.2.0", "react-dom": "^16.2.0", "react-redux": "^5.0.6", diff --git a/src/client/react/App.js b/src/client/react/App.js new file mode 100644 index 0000000..b8bb301 --- /dev/null +++ b/src/client/react/App.js @@ -0,0 +1,15 @@ +import React from 'react'; +import Search from './components/presentational/Search'; + +const App = () => ( +
+ {}} + results={[ + { type: 's', name: '18561' }, + ]} + /> +
+); + +export default App; diff --git a/src/client/react/components/presentational/Search.js b/src/client/react/components/presentational/Search.js new file mode 100644 index 0000000..0dde8a6 --- /dev/null +++ b/src/client/react/components/presentational/Search.js @@ -0,0 +1,24 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +const Search = ({ onInput, results }) => ( +
+ + +
+); + +Search.propTypes = { + onInput: PropTypes.func.isRequired, + results: PropTypes.arrayOf(PropTypes.shape({ + name: PropTypes.string.require, + type: PropTypes.string.require, + })).isRequired, +}; + +export default Search; diff --git a/src/client/react/index.js b/src/client/react/index.js index 7e5f559..bb7a21b 100644 --- a/src/client/react/index.js +++ b/src/client/react/index.js @@ -3,12 +3,13 @@ import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducer from './reducers'; +import App from './App'; const store = createStore(reducer); ReactDOM.render( -
Hello World!
+
, document.getElementById('root'), ); -- cgit v1.1