From ba1cff609dbcd16a2327317635e8cd93108884fd Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Sat, 23 Jan 2021 00:20:31 +0300 Subject: [PATCH] [DE mobile] extended Search view --- .../mobile/resources/less/common-ios.less | 6 + .../mobile/src/controller/Search.jsx | 8 ++ apps/documenteditor/mobile/src/pages/home.jsx | 10 +- .../documenteditor/mobile/src/view/Search.jsx | 116 ++++++++++++++++++ .../documenteditor/mobile/src/view/search.jsx | 67 +++++++++- 5 files changed, 200 insertions(+), 7 deletions(-) create mode 100644 apps/documenteditor/mobile/src/controller/Search.jsx create mode 100644 apps/documenteditor/mobile/src/view/Search.jsx diff --git a/apps/common/mobile/resources/less/common-ios.less b/apps/common/mobile/resources/less/common-ios.less index c6f4ec509..c3d834f89 100644 --- a/apps/common/mobile/resources/less/common-ios.less +++ b/apps/common/mobile/resources/less/common-ios.less @@ -52,6 +52,12 @@ ul { border-radius: 0; } + + li:first-child, li:last-child { + > label { + border-radius: 0; + } + } } } diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx new file mode 100644 index 000000000..6c662c5f3 --- /dev/null +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -0,0 +1,8 @@ +import React from 'react'; +import SearchView, {SearchSettingsView} from '../view/Search' + +const SearchController = props => { + return +}; + +export {SearchController as Search, SearchSettingsView as SearchSettings}; diff --git a/apps/documenteditor/mobile/src/pages/home.jsx b/apps/documenteditor/mobile/src/pages/home.jsx index 05a9efe60..039850096 100644 --- a/apps/documenteditor/mobile/src/pages/home.jsx +++ b/apps/documenteditor/mobile/src/pages/home.jsx @@ -4,8 +4,9 @@ import { Page, View, Navbar, NavLeft, NavRight, Link, Icon } from 'framework7-re import EditOptions from '../view/edit/Edit'; import AddOptions from '../view/add/Add'; import Settings from '../view/settings/Settings'; -import SearchView from '../view/search'; import CollaborationView from '../../../../common/mobile/lib/view/Collaboration.jsx' +import { Device } from '../../../../common/mobile/utils/device' +import { Search, SearchSettings } from '../controller/Search'; export default class Home extends Component { constructor(props) { @@ -59,16 +60,19 @@ export default class Home extends Component { this.handleClickToOpenOptions('edit')}> this.handleClickToOpenOptions('add')}> - + { Device.phone ? null : } this.handleClickToOpenOptions('coauth')}> this.handleClickToOpenOptions('settings')}> - + { Device.phone ? null : } {/* Page content */} + { + Device.phone ? null : + } { !this.state.editOptionsVisible ? null : diff --git a/apps/documenteditor/mobile/src/view/Search.jsx b/apps/documenteditor/mobile/src/view/Search.jsx new file mode 100644 index 000000000..dcbcb6de2 --- /dev/null +++ b/apps/documenteditor/mobile/src/view/Search.jsx @@ -0,0 +1,116 @@ +import React, { Component } from 'react'; +import { Searchbar, Popover, Popup, View, Page, List, ListItem, Navbar, NavRight, Link } from 'framework7-react'; +import { f7ready, f7 } from 'framework7-react'; +import { Device } from '../../../../common/mobile/utils/device'; + +const popoverStyle = { + height: '300px' +}; + +class SearchSettingsView extends Component { + constructor(props) { + super(props); + + this.state = { + useReplace: false, + caseSensitive: false, + markResults: false + }; + } + + onFindReplaceClick(action) { + this.setState({ + useReplace: action == 'replace' + }); + } + + render() { + const show_popover = true; + const navbar = + + {!show_popover && + + Done + } + ; + const content = + + + {navbar} + + this.onFindReplaceClick('find')}> + this.onFindReplaceClick('replace')}> + + + ; + return ( + show_popover ? + {content} : + {content} + ) + } +} + +class SearchView extends Component { + constructor(props) { + super(props); + + $$(document).on('page:init', (e, page) => { + if ( page.name == 'home' ) { + this.$f7.searchbar.create({ + el: '.searchbar', + customSearch: true, + expandable: true, + backdrop: false, + on: { + search: (bar, curval, prevval) => { + console.log('on search results ' + curval); + } + } + }); + } + }); + + this.onSettingsClick = this.onSettingsClick.bind(this); + } + + componentDidMount(){ + } + + onSettingsClick(e) { + if ( Device.phone ) { + // f7.popup.open('.settings-popup'); + } else this.$f7.popover.open('#idx-search-settings', '#idx-btn-search-settings'); + } + + render() { + return ( +
+
+
+
+ + + +
+
+ + + +
+ + Cancel +
+ + ) + } +} + +export {SearchView as default, SearchSettingsView}; diff --git a/apps/documenteditor/mobile/src/view/search.jsx b/apps/documenteditor/mobile/src/view/search.jsx index 30a21695f..dcbcb6de2 100644 --- a/apps/documenteditor/mobile/src/view/search.jsx +++ b/apps/documenteditor/mobile/src/view/search.jsx @@ -1,14 +1,63 @@ import React, { Component } from 'react'; -import { Searchbar, Link } from 'framework7-react'; +import { Searchbar, Popover, Popup, View, Page, List, ListItem, Navbar, NavRight, Link } from 'framework7-react'; import { f7ready, f7 } from 'framework7-react'; +import { Device } from '../../../../common/mobile/utils/device'; -export default class SearchView extends Component { +const popoverStyle = { + height: '300px' +}; + +class SearchSettingsView extends Component { + constructor(props) { + super(props); + + this.state = { + useReplace: false, + caseSensitive: false, + markResults: false + }; + } + + onFindReplaceClick(action) { + this.setState({ + useReplace: action == 'replace' + }); + } + + render() { + const show_popover = true; + const navbar = + + {!show_popover && + + Done + } + ; + const content = + + + {navbar} + + this.onFindReplaceClick('find')}> + this.onFindReplaceClick('replace')}> + + + ; + return ( + show_popover ? + {content} : + {content} + ) + } +} + +class SearchView extends Component { constructor(props) { super(props); $$(document).on('page:init', (e, page) => { if ( page.name == 'home' ) { - f7.searchbar.create({ + this.$f7.searchbar.create({ el: '.searchbar', customSearch: true, expandable: true, @@ -21,18 +70,26 @@ export default class SearchView extends Component { }); } }); + + this.onSettingsClick = this.onSettingsClick.bind(this); } componentDidMount(){ } + onSettingsClick(e) { + if ( Device.phone ) { + // f7.popup.open('.settings-popup'); + } else this.$f7.popover.open('#idx-search-settings', '#idx-btn-search-settings'); + } + render() { return (
@@ -55,3 +112,5 @@ export default class SearchView extends Component { ) } } + +export {SearchView as default, SearchSettingsView};