[IMPROVEMENT] Move directory to header (#2414)

This commit is contained in:
Diego Mello 2020-08-20 11:16:33 -03:00 committed by GitHub
parent f9b201caaf
commit 0c55d15378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 58 deletions

View File

@ -1,44 +0,0 @@
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import Touch from '../../../utils/touch';
import { CustomIcon } from '../../../lib/Icons';
import I18n from '../../../i18n';
import styles from '../styles';
import DisclosureIndicator from '../../../containers/DisclosureIndicator';
import { themes } from '../../../constants/colors';
import { withTheme } from '../../../theme';
const Directory = React.memo(({ goDirectory, theme, searching }) => {
if (searching > 0) {
return null;
}
const color = { color: themes[theme].headerSecondaryText };
return (
<Touch
onPress={goDirectory}
theme={theme}
style={{ backgroundColor: themes[theme].headerSecondaryBackground }}
>
<View
style={[
styles.dropdownContainerHeader,
{ borderBottomWidth: StyleSheet.hairlineWidth, borderColor: themes[theme].separatorColor }
]}
>
<CustomIcon style={[styles.directoryIcon, color]} size={22} name='directory' />
<Text style={[styles.directoryText, color]}>{I18n.t('Directory')}</Text>
<DisclosureIndicator theme={theme} />
</View>
</Touch>
);
});
Directory.propTypes = {
searching: PropTypes.bool,
goDirectory: PropTypes.func,
theme: PropTypes.string
};
export default withTheme(Directory);

View File

@ -2,20 +2,17 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Queue from './Queue'; import Queue from './Queue';
import Directory from './Directory';
import Sort from './Sort'; import Sort from './Sort';
const ListHeader = React.memo(({ const ListHeader = React.memo(({
searching, searching,
sortBy, sortBy,
toggleSort, toggleSort,
goDirectory,
goQueue, goQueue,
queueSize, queueSize,
inquiryEnabled inquiryEnabled
}) => ( }) => (
<> <>
<Directory searching={searching} goDirectory={goDirectory} />
<Sort searching={searching} sortBy={sortBy} toggleSort={toggleSort} /> <Sort searching={searching} sortBy={sortBy} toggleSort={toggleSort} />
<Queue searching={searching} goQueue={goQueue} queueSize={queueSize} inquiryEnabled={inquiryEnabled} /> <Queue searching={searching} goQueue={goQueue} queueSize={queueSize} inquiryEnabled={inquiryEnabled} />
</> </>
@ -25,7 +22,6 @@ ListHeader.propTypes = {
searching: PropTypes.bool, searching: PropTypes.bool,
sortBy: PropTypes.string, sortBy: PropTypes.string,
toggleSort: PropTypes.func, toggleSort: PropTypes.func,
goDirectory: PropTypes.func,
goQueue: PropTypes.func, goQueue: PropTypes.func,
queueSize: PropTypes.number, queueSize: PropTypes.number,
inquiryEnabled: PropTypes.bool inquiryEnabled: PropTypes.bool

View File

@ -372,6 +372,12 @@ class RoomsListView extends React.Component {
onPress={this.initSearching} onPress={this.initSearching}
testID='rooms-list-view-search' testID='rooms-list-view-search'
/> />
<Item
title='directory'
iconName='directory'
onPress={this.goDirectory}
testID='rooms-list-view-directory'
/>
</CustomHeaderButtons> </CustomHeaderButtons>
)) ))
}; };

View File

@ -116,15 +116,5 @@ export default StyleSheet.create({
serverSeparator: { serverSeparator: {
height: StyleSheet.hairlineWidth, height: StyleSheet.hairlineWidth,
marginLeft: 72 marginLeft: 72
},
directoryIcon: {
width: 22,
height: 22,
marginHorizontal: 12
},
directoryText: {
fontSize: 16,
flex: 1,
...sharedStyles.textRegular
} }
}); });