diff --git a/apps/documenteditor/mobile/src/components/settings/Settings.jsx b/apps/documenteditor/mobile/src/components/settings/Settings.jsx index 69a7043b2..93e9e8eb1 100644 --- a/apps/documenteditor/mobile/src/components/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/components/settings/Settings.jsx @@ -1,63 +1,97 @@ import React, {Component, useEffect} from 'react'; -import {View,Page,Navbar,NavRight,Link,Popup,Icon,ListItem,List} from 'framework7-react'; +import {View,Page,Navbar,NavRight,Link,Popup,Popover,Icon,ListItem,List} from 'framework7-react'; import { withTranslation } from 'react-i18next'; -import { f7 } from 'framework7-react'; +import {f7} from 'framework7-react'; +import {Device} from '../../../../../common/mobile/utils/device' + + +const SettingsView = props => { + const {t} = props; + const _t = t('ViewSettings', {returnObjects: true}); + const navbar = + {!props.isPopover && {t('ViewSettings.textDone')}} + ; + + const onoptionclick = page => { + if ( props.onOptionClick ) + props.onOptionClick(page) + }; + + return ( + + + {navbar} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) +}; + +const TSettingsView = withTranslation()(SettingsView); class SettingsPopup extends Component { constructor(props) { super(props); } render() { - const { t } = this.props; - const _trarr = t('ViewSettings', {returnObjects: true}); - return ( this.props.onclosed()}> - - - - - {t('ViewSettings.textDone')} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ) } } -const HOCSettingsPopup = withTranslation()(SettingsPopup); +class SettingsPopover extends Component { + constructor(props) { + super(props) + + this.onoptionclick = this.onoptionclick.bind(this); + } + + onoptionclick(page){ + this.$f7.views.current.router.navigate(page); + } + + render() { + return ( + this.props.onclosed()}> + + + ) + } +} const Settings = props => { useEffect(() => { - f7.popup.open('.settings-popup'); + if ( Device.phone ) + f7.popup.open('.settings-popup'); + else f7.popover.open('.settings__popover', '#btn-settings'); return () => { // component will unmount @@ -70,7 +104,11 @@ const Settings = props => { props.onclosed(); }; - return + if ( Device.phone ) { + return + } + + return }; export default Settings; diff --git a/apps/documenteditor/mobile/src/css/app.less b/apps/documenteditor/mobile/src/css/app.less index 98c60ef58..8b5f430b0 100644 --- a/apps/documenteditor/mobile/src/css/app.less +++ b/apps/documenteditor/mobile/src/css/app.less @@ -31,4 +31,14 @@ background: rgba(0,0,0,0.1); content: ''; z-index: 6000; +} + +:root { + --f7-popover-width: 360px; +} + +.ios { + .popover-inner { + //border-radius: var(--f7-popover-border-radius); + } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/pages/home.jsx b/apps/documenteditor/mobile/src/pages/home.jsx index 9a79446e3..978b6ff00 100644 --- a/apps/documenteditor/mobile/src/pages/home.jsx +++ b/apps/documenteditor/mobile/src/pages/home.jsx @@ -57,7 +57,7 @@ export default class Home extends Component { this.handleClickToOpenOptions('edit')}>Edit this.handleClickToOpenOptions('coauth')}>Users - this.handleClickToOpenOptions('settings')}>Settings + this.handleClickToOpenOptions('settings')} id='btn-settings'>Settings {/* Page content */}