From bb6095f6695da699b09cb374d1c4059383100325 Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Mon, 16 Sep 2019 12:11:08 +0300 Subject: [PATCH] demo search ui implemented --- src/routes/Search/Search.js | 28 ++++++++++++++++--------- src/routes/Search/styles.less | 38 +++++++++++++++++++++++++++++++++- src/routes/Search/useSearch.js | 32 ++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 src/routes/Search/useSearch.js diff --git a/src/routes/Search/Search.js b/src/routes/Search/Search.js index 60893ee32..b97096a5b 100644 --- a/src/routes/Search/Search.js +++ b/src/routes/Search/Search.js @@ -1,16 +1,24 @@ const React = require('react'); -const { MainNavBar } = require('stremio/common'); +const { MainNavBar, MetaRow } = require('stremio/common'); +const useSearch = require('./useSearch'); const styles = require('./styles'); -class Search extends React.Component { - render() { - return ( - - -
- - ); - } +const Search = ({ queryParams }) => { + const groups = useSearch(queryParams.get('q')); + return ( +
+ +
+ {groups.map((group, index) => ( + + ))} +
+
+ ); } module.exports = Search; diff --git a/src/routes/Search/styles.less b/src/routes/Search/styles.less index ff27d50b5..40e01a4d2 100644 --- a/src/routes/Search/styles.less +++ b/src/routes/Search/styles.less @@ -1,4 +1,40 @@ +:import('~stremio/common/MetaRow/styles.less') { + meta-item: meta-item; +} + .search-container { - background-color: var(--color-background); + display: flex; + flex-direction: column; + width: 100%; height: 100%; + background-color: var(--color-background); + + .nav-bar { + flex: none; + align-self: stretch; + } + + .search-content { + flex: 1; + align-self: stretch; + overflow-y: auto; + + .search-row { + margin: 4rem 2rem; + + &:first-child { + margin-top: 2rem; + } + + &:last-child { + margin-bottom: 2rem; + } + + .meta-item { + &:nth-child(n+6) { + display: none; + } + } + } + } } \ No newline at end of file diff --git a/src/routes/Search/useSearch.js b/src/routes/Search/useSearch.js new file mode 100644 index 000000000..68289c202 --- /dev/null +++ b/src/routes/Search/useSearch.js @@ -0,0 +1,32 @@ +const React = require('react'); + +const useSearch = (query) => { + const items = React.useMemo(() => { + return [ + { + title: 'demo addon', + items: [ + { + id: '1', + type: 'movie', + name: 'Stremio demo item movie 1', + poster: '/images/intro_background.jpg', + logo: '/images/default_avatar.png', + posterShape: 'poster' + }, + { + id: '2', + type: 'movie', + name: 'Stremio demo item movie 2', + poster: '/images/intro_background.jpg', + logo: '/images/default_avatar.png', + posterShape: 'poster' + }, + ] + } + ]; + }, [query]); + return items; +}; + +module.exports = useSearch;