You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Added sidebar
This commit is contained in:
23
ReactNativeClient/lib/components/shared/side-menu-shared.js
Normal file
23
ReactNativeClient/lib/components/shared/side-menu-shared.js
Normal file
@@ -0,0 +1,23 @@
|
||||
let shared = {};
|
||||
|
||||
shared.renderFolders = function(props, renderItem) {
|
||||
let items = [];
|
||||
for (let i = 0; i < props.folders.length; i++) {
|
||||
let folder = props.folders[i];
|
||||
items.push(renderItem(folder, props.selectedFolderId == folder.id && props.notesParentType == 'Folder'));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
shared.renderTags = function(props, renderItem) {
|
||||
let tags = props.tags.slice();
|
||||
tags.sort((a, b) => { return a.title < b.title ? -1 : +1; });
|
||||
let tagItems = [];
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
const tag = tags[i];
|
||||
tagItems.push(renderItem(tag, props.selectedTagId == tag.id && props.notesParentType == 'Tag'));
|
||||
}
|
||||
return tagItems;
|
||||
}
|
||||
|
||||
module.exports = shared;
|
||||
@@ -11,6 +11,7 @@ const { Synchronizer } = require('lib/synchronizer.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { globalStyle, themeStyle } = require('lib/components/global-style.js');
|
||||
const shared = require('lib/components/shared/side-menu-shared.js');
|
||||
|
||||
class SideMenuContentComponent extends Component {
|
||||
|
||||
@@ -188,22 +189,13 @@ class SideMenuContentComponent extends Component {
|
||||
items.push(<View style={{ height: globalStyle.marginTop }} key='bottom_top_hack'/>);
|
||||
|
||||
if (this.props.folders.length) {
|
||||
for (let i = 0; i < this.props.folders.length; i++) {
|
||||
let folder = this.props.folders[i];
|
||||
items.push(this.folderItem(folder, this.props.selectedFolderId == folder.id && this.props.notesParentType == 'Folder'));
|
||||
}
|
||||
|
||||
const folderItems = shared.renderFolders(this.props, this.folderItem.bind(this));
|
||||
items = items.concat(folderItems);
|
||||
if (items.length) items.push(this.makeDivider('divider_1'));
|
||||
}
|
||||
|
||||
if (this.props.tags.length) {
|
||||
let tags = this.props.tags.slice();
|
||||
tags.sort((a, b) => { return a.title < b.title ? -1 : +1; });
|
||||
let tagItems = [];
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
const tag = tags[i];
|
||||
tagItems.push(this.tagItem(tag, this.props.selectedTagId == tag.id && this.props.notesParentType == 'Tag'));
|
||||
}
|
||||
const tagItems = shared.renderTags(this.props, this.tagItem.bind(this));
|
||||
|
||||
items.push(
|
||||
<View style={this.styles().tagItemList} key="tag_items">
|
||||
|
||||
Reference in New Issue
Block a user