mattermost-mobile/app/screens/search/modifier.js
Miguel Alatzar 57d60649f8
[MM-22959] Use Compass icons (#4847)
* Use Compass icons

* Update ChannelInfo and AdvancedSettings

* Fix search modifiers

* Fix Autocomplete item

* Remove VectorIcon component

* Unlink react-native-vector-icons

* Revert ProgressiveImage changes

* Update Mark as Unread icon

* Apply review suggestion

* Replace extension icons

* Update video control button style

* Replace (un)flag with (un)save

* Replace (un)flag with (un)save - take 2

* Use bookmark-outline icon

Co-authored-by: Miguel Alatzar <miguel@Miguels-MacBook-Pro.local>
2020-10-15 15:34:24 -07:00

110 lines
3.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Text, TouchableHighlight, View} from 'react-native';
import {paddingHorizontal as padding} from 'app/components/safe_area_view/iphone_x_spacing';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
export const MODIFIER_LABEL_HEIGHT = 68;
export default class Modifier extends PureComponent {
static propTypes = {
item: PropTypes.object.isRequired,
setModifierValue: PropTypes.func.isRequired,
theme: PropTypes.object.isRequired,
isLandscape: PropTypes.bool.isRequired,
};
static defaultProps = {
isLandscape: false,
};
handlePress = () => {
const {item, setModifierValue} = this.props;
setModifierValue(item.value);
};
render() {
const {item, theme, isLandscape} = this.props;
const style = getStyleFromTheme(theme);
return (
<TouchableHighlight
key={item.modifier}
underlayColor={changeOpacity(theme.sidebarTextHoverBg, 0.5)}
onPress={this.handlePress}
>
<View
testID={item.testID}
style={style.modifierItemContainer}
>
<View style={[style.modifierItemWrapper, padding(isLandscape)]}>
<View style={style.modifierItemLabelContainer}>
<View style={style.modifierLabelValueContainer}>
<Text
style={style.modifierLabelValue}
>
{item.value.toUpperCase()}
</Text>
</View>
<Text
style={style.modifierItemLabel}
>
{item.modifier}
</Text>
</View>
<Text style={style.modifierItemDescription}>
{item.description}
</Text>
</View>
</View>
</TouchableHighlight>
);
}
}
const getStyleFromTheme = makeStyleSheetFromTheme((theme) => {
return {
modifierItemContainer: {
alignItems: 'center',
flex: 1,
flexDirection: 'row',
height: MODIFIER_LABEL_HEIGHT,
},
modifierItemWrapper: {
flex: 1,
flexDirection: 'column',
paddingHorizontal: 16,
},
modifierItemLabelContainer: {
alignItems: 'center',
flexDirection: 'row',
},
modifierLabelValueContainer: {
alignItems: 'center',
marginRight: 5,
backgroundColor: changeOpacity(theme.centerChannelColor, 0.08),
borderRadius: 4,
paddingHorizontal: 4,
paddingVertical: 2,
fontWeight: '600',
},
modifierLabelValue: {
fontSize: 10,
color: theme.centerChannelColor,
},
modifierItemLabel: {
fontSize: 15,
color: theme.centerChannelColor,
},
modifierItemDescription: {
fontSize: 12,
color: changeOpacity(theme.centerChannelColor, 0.5),
marginTop: 5,
},
};
});