import React, { Component } from 'react'; import { Searchbar, Popover, Popup, View, Page, List, ListItem, Navbar, NavRight, Link } from 'framework7-react'; import { Toggle } from 'framework7-react'; import { f7 } from 'framework7-react'; import { Dom7 } from 'framework7'; import { Device } from '../../../../common/mobile/utils/device'; import { observable } from "mobx"; import { observer } from "mobx-react"; const searchOptions = observable({ usereplace: false }); const popoverStyle = { height: '300px' }; class SearchSettingsView extends Component { constructor(props) { super(props); this.state = { useReplace: false, caseSensitive: false, markResults: false }; } onFindReplaceClick(action) { searchOptions.usereplace = action == 'replace'; this.setState({ useReplace: searchOptions.usereplace }); if (this.onReplaceChecked) {} } render() { const show_popover = true; const navbar = {!show_popover && Done } ; const content = {navbar} this.onFindReplaceClick('find')} /> this.onFindReplaceClick('replace')} /> ; return ( show_popover ? {content} : {content} ) } } @observer class SearchView extends Component { constructor(props) { super(props); $$(document).on('page:init', (e, page) => { if ( page.name == 'home' ) { this.searchbar = f7.searchbar.create({ el: '.searchbar', customSearch: true, expandable: true, backdrop: false, on: { search: (bar, curval, prevval) => { } } }); } }); this.onSettingsClick = this.onSettingsClick.bind(this); this.onSearchClick = this.onSearchClick.bind(this); } componentDidMount(){ const $$ = Dom7; this.$repalce = $$('#idx-replace-val'); } onSettingsClick(e) { if ( Device.phone ) { // f7.popup.open('.settings-popup'); } else f7.popover.open('#idx-search-settings', '#idx-btn-search-settings'); } searchParams() { let params = { text: this.searchbar.query, direction: action }; } onSearchClick(action) { if ( this.searchbar && this.searchbar.query) { if ( this.props.onSearchQuery ) { let params = { text: this.searchbar.query, direction: action }; if ( searchOptions.usereplace ) params.replace = this.$replace.val(); this.props.onSearchQuery(params); } } } render() { const usereplace = searchOptions.usereplace; const hidden = {display: "none"}; return (
Cancel
) } } export {SearchView as default, SearchSettingsView};