From 430a11282b34bbefa19f46f35b0a53be529bd823 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 26 Jun 2019 01:10:15 +0100 Subject: [PATCH] Mobile: Moved 'New notebook' button to sidebar --- .../lib/components/action-button.js | 15 -------- .../lib/components/side-menu-content.js | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ReactNativeClient/lib/components/action-button.js b/ReactNativeClient/lib/components/action-button.js index 4e69f0ecb..3b8e75405 100644 --- a/ReactNativeClient/lib/components/action-button.js +++ b/ReactNativeClient/lib/components/action-button.js @@ -52,14 +52,6 @@ class ActionButtonComponent extends React.Component { }); } - newFolder_press() { - this.props.dispatch({ - type: 'NAV_GO', - routeName: 'Folder', - folderId: null, - }); - } - render() { let buttons = this.props.buttons ? this.props.buttons : []; @@ -79,13 +71,6 @@ class ActionButtonComponent extends React.Component { icon: 'md-document', }); } - - buttons.push({ - title: _('New notebook'), - onPress: () => { this.newFolder_press() }, - color: '#3498db', - icon: 'md-folder', - }); } let buttonComps = []; diff --git a/ReactNativeClient/lib/components/side-menu-content.js b/ReactNativeClient/lib/components/side-menu-content.js index b773210a5..12dc2cc0d 100644 --- a/ReactNativeClient/lib/components/side-menu-content.js +++ b/ReactNativeClient/lib/components/side-menu-content.js @@ -19,12 +19,13 @@ class SideMenuContentComponent extends Component { constructor() { super(); - this.state = { syncReportText: '', - //width: 0, + this.state = { + syncReportText: '', }; this.styles_ = {}; this.tagButton_press = this.tagButton_press.bind(this); + this.newFolderButton_press = this.newFolderButton_press.bind(this); } styles() { @@ -58,6 +59,10 @@ class SideMenuContentComponent extends Component { color: theme.colorFaded, fontSize: theme.fontSizeSmaller, }, + sidebarIcon: { + fontSize: 22, + color: theme.color, + }, }; styles.folderButton = Object.assign({}, styles.button); @@ -102,6 +107,16 @@ class SideMenuContentComponent extends Component { }); } + newFolderButton_press() { + this.props.dispatch({ type: 'SIDE_MENU_CLOSE' }); + + this.props.dispatch({ + type: 'NAV_GO', + routeName: 'Folder', + folderId: null, + }); + } + async synchronize_press() { const actionDone = await shared.synchronize_press(this); if (actionDone === 'auth') this.props.dispatch({ type: 'SIDE_MENU_CLOSE' }); @@ -149,7 +164,7 @@ class SideMenuContentComponent extends Component { const theme = themeStyle(this.props.theme); const title = state == 'sync' ? _('Synchronise') : _('Cancel synchronisation'); - const iconComp = state == 'sync' ? : ; + const iconComp = state == 'sync' ? : ; return ( { this.synchronize_press() }}> @@ -161,14 +176,14 @@ class SideMenuContentComponent extends Component { ); } - tagButton() { + renderSideBarButton(key, title, iconName, onPressHandler) { const theme = themeStyle(this.props.theme); return ( - + - - Tags + + {title} ); @@ -214,10 +229,10 @@ class SideMenuContentComponent extends Component { } items.push(this.makeDivider('divider_1')); - - items.push(this.tagButton()); - items.push(this.makeDivider('divider_tag_bottom')); + items.push(this.renderSideBarButton('newFolder_button', _('New Notebook'), 'md-folder-open', this.newFolderButton_press)); + + items.push(this.renderSideBarButton('tag_button', _('Tags'), 'md-pricetag', this.tagButton_press)); let lines = Synchronizer.reportToLines(this.props.syncReport); const syncReportText = lines.join("\n");