Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

change tags section ui

ammarahm-ed2629870805ee
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index 7b1ae592e..1860b059c 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -1,102 +1,119 @@
-import React, { useEffect } from 'react';
-import { Text, TouchableOpacity, View } from 'react-native';
-import { useTracked } from '../../provider';
-import { Actions } from '../../provider/Actions';
-import { eSendEvent } from '../../services/EventManager';
-import { refreshNotesPage } from '../../utils/Events';
+import React, {useEffect} from 'react';
+import {Text, TouchableOpacity, View} from 'react-native';
+import {useTracked} from '../../provider';
+import {Actions} from '../../provider/Actions';
+import {eSendEvent} from '../../services/EventManager';
+import {refreshNotesPage} from '../../utils/Events';
import NavigationService from '../../services/Navigation';
-import {opacity, SIZE, WEIGHT} from "../../utils/SizeUtils";
-
+import {opacity, SIZE, WEIGHT} from '../../utils/SizeUtils';
+import {PressableButton} from '../PressableButton';
export const TagsSection = () => {
const [state, dispatch] = useTracked();
- const {colors,tags} = state;
-
+ const {colors, tags, currentScreen} = state;
useEffect(() => {
dispatch({type: Actions.TAGS});
}, []);
- return (<View
- style={{
- flexDirection: 'row',
- flexWrap: 'wrap',
- marginBottom: 0,
- }}>
- {tags
- .filter(o => o.noteIds.length > 1)
- .slice(0, tags.length > 10 ? 10 : tags.length)
- .map(item => (
- <TouchableOpacity
- key={item.title}
- activeOpacity={opacity / 2}
- onPress={() => {
- let params = {
- title: item.title,
- tag: item,
- type: 'tag',
- };
- dispatch({
- type: Actions.HEADER_VERTICAL_MENU,
- state: false,
- });
- dispatch({
- type: Actions.HEADER_TEXT_STATE,
- state: {
- heading: item.title,
- },
- });
- NavigationService.navigate('Notes', params);
- eSendEvent(refreshNotesPage, params);
- sideMenuRef.current?.closeDrawer();
- }}
- style={{
- flexDirection: 'row',
- justifyContent: 'flex-start',
- alignItems: 'center',
- padding: 5,
- paddingHorizontal: 0,
- marginLeft: 5,
- marginTop: 5,
- borderBottomWidth: 1,
- borderBottomColor: colors.nav,
- }}>
- <Text
- style={{
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.sm - 1,
- color: colors.accent,
- }}>
- #
- </Text>
- <Text
- style={{
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.sm - 1,
- color: colors.icon,
+ const onPress = (item) => {
+ let params = {
+ title: item.title,
+ tag: item,
+ type: 'tag',
+ menu: true,
+ };
+ dispatch({
+ type: Actions.HEADER_VERTICAL_MENU,
+ state: false,
+ });
+ dispatch({
+ type: Actions.HEADER_TEXT_STATE,
+ state: {
+ heading: item.title,
+ },
+ });
+ NavigationService.navigate('Notes', params);
+ eSendEvent(refreshNotesPage, params);
+ NavigationService.closeDrawer();
+ };
+ useEffect(() => {
+ console.log(currentScreen);
+ }, [currentScreen]);
+ return (
+ <View
+ style={{
+ width: '100%',
+ }}>
+ {tags
+ .filter((o) => o.noteIds.length > 1)
+ .slice(0, tags.length > 10 ? 10 : tags.length)
+ .map((item) => (
+ <PressableButton
+ key={item.id}
+ color={
+ currentScreen === item.title.toLowerCase()
+ ? colors.shade
+ : 'transparent'
+ }
+ selectedColor={colors.accent}
+ alpha={!colors.night ? -0.02 : 0.02}
+ opacity={0.12}
+ onPress={() => onPress(item)}
+ customStyle={{
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ width: '100%',
+ borderRadius: 0,
+ paddingHorizontal: 10,
+ height: 50,
}}>
- {item.title + ' '}
- </Text>
- {item.noteIds.length > 1 ? (
- <Text
+ <View
+ style={{
+ width: 35,
+ height: 35,
+ justifyContent: 'center',
+ alignItems: 'flex-start',
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ }}>
+ #
+ </Text>
+ </View>
+ <View
style={{
- color: 'white',
- backgroundColor: colors.accent,
- fontSize: SIZE.xxs,
- minWidth: 12,
- minHeight: 12,
- borderRadius: 2,
- textAlign: 'center',
- padding: 0,
- paddingHorizontal: 1,
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ width: '85%',
}}>
- {item.noteIds.length > 99 ? '99+' : item.noteIds.length}
- </Text>
- ) : null}
- </TouchableOpacity>
- ))}
- </View>
+ <Text
+ style={{
+ fontFamily: WEIGHT.regular,
+ fontSize: SIZE.sm,
+ color: colors.heading,
+ }}>
+ {item.title}
+ </Text>
-
+ {/* {item.noteIds.length > 1 ? (
+ <Text
+ style={{
+ color: colors.icon,
+ fontSize: SIZE.xs,
+ paddingHorizontal: 5,
+ }}>
+ {item.noteIds.length > 99 ? '99+' : item.noteIds.length}
+ </Text>
+ ) : null} */}
+ </View>
+ </PressableButton>
+ ))}
+ </View>
);
};