diff options
Diffstat (limited to 'src/components/moments/Moment.tsx')
-rw-r--r-- | src/components/moments/Moment.tsx | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 446bc07b..623e328d 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -12,6 +12,8 @@ import {Text} from 'react-native-animatable'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; import LinearGradient from 'react-native-linear-gradient'; import PlusIcon from '../../assets/icons/plus_icon-01.svg'; +import UpIcon from '../../assets/icons/up_icon.svg'; +import DownIcon from '../../assets/icons/down_icon.svg'; import DeleteIcon from '../../assets/icons/delete-logo.svg'; import BigPlusIcon from '../../assets/icons/plus_icon-02.svg'; import {TAGG_TEXT_LIGHT_BLUE} from '../../constants'; @@ -19,6 +21,7 @@ import {SCREEN_WIDTH} from '../../utils'; import ImagePicker from 'react-native-image-crop-picker'; import MomentTile from './MomentTile'; import {MomentType, ScreenType} from 'src/types'; +import {useDispatch} from 'react-redux'; interface MomentProps { title: string; @@ -27,6 +30,9 @@ interface MomentProps { screenType: ScreenType; handleMomentCategoryDelete: (_: string) => void; shouldAllowDeletion: boolean; + showUpButton: boolean; + showDownButton: boolean; + move?: (direction: 'up' | 'down', title: string) => void; externalStyles?: Record<string, StyleProp<ViewStyle>>; } @@ -37,9 +43,13 @@ const Moment: React.FC<MomentProps> = ({ screenType, handleMomentCategoryDelete, shouldAllowDeletion, + showUpButton, + showDownButton, + move, externalStyles, }) => { const navigation = useNavigation(); + const dispatch = useDispatch(); const navigateToImagePicker = () => { ImagePicker.openPicker({ @@ -71,12 +81,14 @@ const Moment: React.FC<MomentProps> = ({ } }); }; + return ( <View style={[styles.container, externalStyles?.container]}> <View style={[styles.header, externalStyles?.header]}> <Text style={[styles.titleText, externalStyles?.titleText]}> {title} </Text> + <View style={styles.flexer} /> {!userXId ? ( <> <PlusIcon @@ -86,6 +98,24 @@ const Moment: React.FC<MomentProps> = ({ color={TAGG_TEXT_LIGHT_BLUE} style={{marginRight: 10}} /> + {showUpButton && move && ( + <UpIcon + width={19} + height={19} + onPress={() => move('up', title)} + color={TAGG_TEXT_LIGHT_BLUE} + style={{marginRight: 10}} + /> + )} + {showDownButton && move && ( + <DownIcon + width={19} + height={19} + onPress={() => move('down', title)} + color={TAGG_TEXT_LIGHT_BLUE} + style={{marginRight: 10}} + /> + )} {shouldAllowDeletion && ( <DeleteIcon onPress={() => handleMomentCategoryDelete(title)} @@ -146,9 +176,14 @@ const styles = StyleSheet.create({ fontSize: 16, fontWeight: 'bold', color: TAGG_TEXT_LIGHT_BLUE, + }, + // titleContainer: { + // flex: 1, + // flexDirection: 'row', + // justifyContent: 'flex-end', + // }, + flexer: { flex: 1, - flexDirection: 'row', - justifyContent: 'flex-end', }, scrollContainer: { height: SCREEN_WIDTH / 3.25, |