Skip to content

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

change menu items ui

ammarahm-ed38e44d0ae0a2
diff --git a/apps/mobile/src/components/Menu/ColorSection.js b/apps/mobile/src/components/Menu/ColorSection.js
index 33dfabc41..23bbc2363 100644
--- a/apps/mobile/src/components/Menu/ColorSection.js
+++ b/apps/mobile/src/components/Menu/ColorSection.js
@@ -1,19 +1,17 @@
-import React, {useEffect, useState} from 'react';
-import {View} from 'react-native';
-import {useTracked} from '../../provider';
-import {Actions} from '../../provider/Actions';
+import React, { useEffect, useState } from 'react';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
import { useMenuStore, useNoteStore } from '../../provider/stores';
import {
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent,
+ eUnSubscribeEvent
} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import {getElevation} from '../../utils';
-import {COLORS_NOTE} from '../../utils/Colors';
-import {refreshNotesPage} from '../../utils/Events';
-import {normalize, SIZE} from '../../utils/SizeUtils';
-import {PressableButton} from '../PressableButton';
+import { COLORS_NOTE } from '../../utils/Colors';
+import { refreshNotesPage } from '../../utils/Events';
+import { normalize, SIZE } from '../../utils/SizeUtils';
+import { PressableButton } from '../PressableButton';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -73,20 +71,21 @@ const ColorItem = ({item, index}) => {
return (
<PressableButton
- customColor="transparent"
+ customColor={headerTextState?.id === item.id? "rgba(0,0,0,0.04)" : "transparent"}
customSelectedColor={COLORS_NOTE[item.title]}
customAlpha={!colors.night ? -0.02 : 0.02}
customOpacity={0.12}
onPress={() => onPress(item)}
customStyle={{
width: '100%',
- alignSelf: 'center',
- borderRadius: 0,
- flexDirection: 'row',
- paddingHorizontal: 8,
- justifyContent: 'space-between',
- alignItems: 'center',
- height: normalize(50),
+ alignSelf: 'center',
+ borderRadius: 5,
+ flexDirection: 'row',
+ paddingHorizontal: 8,
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ height: normalize(50),
+ marginBottom: 5,
}}>
<View
style={{
@@ -111,30 +110,15 @@ const ColorItem = ({item, index}) => {
/>
</View>
{headerTextState?.id === item.id ? (
- <Heading color={COLORS_NOTE[item.title.toLowerCase()]} size={SIZE.md}>
+ <Heading color={colors.heading} size={SIZE.md}>
{item.title.slice(0, 1).toUpperCase() + item.title.slice(1)}
</Heading>
) : (
- <Paragraph color={colors.heading} size={SIZE.md}>
+ <Paragraph color={colors.pri} size={SIZE.md}>
{item.title.slice(0, 1).toUpperCase() + item.title.slice(1)}
</Paragraph>
)}
</View>
-
- <View
- style={{
- backgroundColor:
- headerTextState?.id === item.id
- ? COLORS_NOTE[item.title.toLowerCase()]
- : 'transparent',
- width: 7,
- height: 7,
- borderRadius: 100,
- ...getElevation(
- headerTextState?.id === item.id + '_navigation' ? 1 : 0,
- ),
- }}
- />
</PressableButton>
);
};
diff --git a/apps/mobile/src/components/Menu/MenuListItem.js b/apps/mobile/src/components/Menu/MenuListItem.js
index 3cc5a6f36..c26d39173 100644
--- a/apps/mobile/src/components/Menu/MenuListItem.js
+++ b/apps/mobile/src/components/Menu/MenuListItem.js
@@ -15,8 +15,10 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {
const [state, dispatch] = useTracked();
const {colors} = state;
const [headerTextState, setHeaderTextState] = useState(null);
+ let isFocused =
+ headerTextState?.id === item.name.toLowerCase() + '_navigation';
- const _onPress = (event) => {
+ const _onPress = event => {
if (item.func) {
item.func();
} else {
@@ -36,7 +38,7 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {
}
};
- const onHeaderStateChange = (event) => {
+ const onHeaderStateChange = event => {
if (event.id === item.name.toLowerCase() + '_navigation') {
setHeaderTextState(event);
} else {
@@ -56,16 +58,17 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {
testID={testID}
key={item.name + index}
onPress={_onPress}
- type="transparent"
+ type={!isFocused ? 'gray' : 'grayBg'}
customStyle={{
- width: '100%',
+ width:'100%',
alignSelf: 'center',
- borderRadius: 0,
+ borderRadius: 5,
flexDirection: 'row',
paddingHorizontal: 8,
justifyContent: 'space-between',
alignItems: 'center',
height: normalize(50),
+ marginBottom:5
}}>
<View
style={{
@@ -78,20 +81,18 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {
textAlignVertical: 'center',
textAlign: 'left',
}}
- name={item.icon}
- color={
- headerTextState?.id === item.name.toLowerCase() + '_navigation'
- ? colors.accent
- : colors.pri
- }
+ name={ item.icon}
+ color={isFocused ? colors.accent : colors.pri}
size={SIZE.lg - 2}
/>
- {headerTextState?.id === item.name.toLowerCase() + '_navigation' ? (
- <Heading color={colors.accent} size={SIZE.md}>
+ {isFocused ? (
+ <Heading color={colors.heading} size={SIZE.md}>
{item.name}
</Heading>
) : (
- <Paragraph color={colors.heading} size={SIZE.md}>{item.name}</Paragraph>
+ <Paragraph size={SIZE.md}>
+ {item.name}
+ </Paragraph>
)}
</View>
@@ -115,24 +116,7 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {
}}
onPress={rightBtn.func}
/>
- ) : (
- <View
- style={{
- backgroundColor:
- headerTextState?.id === item.name.toLowerCase() + '_navigation'
- ? colors.accent
- : 'transparent',
- width: 7,
- height: 7,
- borderRadius: 100,
- ...getElevation(
- headerTextState?.id === item.name.toLowerCase() + '_navigation'
- ? 1
- : 0,
- ),
- }}
- />
- )}
+ ) : null}
</PressableButton>
);
};
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index 872e6ffe4..0806d1740 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -120,7 +120,7 @@ const PinItem = ({item, index, onPress}) => {
}, []);
const icons = {
- topic: 'format-title',
+ topic: 'book-open-outline',
notebook: 'book-outline',
tag: 'pound',
};
@@ -141,6 +141,7 @@ const PinItem = ({item, index, onPress}) => {
type="error"
onPress={async () => {
await db.settings.unpin(item.id);
+ setVisible(false);
setMenuPins();
}}
fontSize={SIZE.md}
@@ -153,20 +154,22 @@ const PinItem = ({item, index, onPress}) => {
</ActionSheetWrapper>
)}
<PressableButton
- type="transparent"
+ type={headerTextState?.id === item.id ? 'grayBg' : 'gray'}
onLongPress={() => {
- setVisible(true);
+ setVisible(!visible);
fwdRef.current?.show();
}}
onPress={() => onPress(item)}
customStyle={{
+ width: '100%',
+ alignSelf: 'center',
+ borderRadius: 5,
flexDirection: 'row',
+ paddingHorizontal: 8,
justifyContent: 'space-between',
alignItems: 'center',
- width: '100%',
- borderRadius: 0,
- paddingHorizontal: 10,
- minHeight: normalize(50),
+ height: normalize(50),
+ marginBottom: 5,
}}>
<View
style={{
@@ -184,7 +187,7 @@ const PinItem = ({item, index, onPress}) => {
<Icon
style={{
position: 'absolute',
- bottom: -5,
+ bottom: -6,
left: -6,
}}
color={color}
@@ -203,33 +206,17 @@ const PinItem = ({item, index, onPress}) => {
style={{
flexWrap: 'wrap',
}}
- color={colors.accent}
+ color={colors.heading}
size={SIZE.md}>
{item.title}
</Heading>
) : (
- <Paragraph
- numberOfLines={1}
- color={colors.heading}
- size={SIZE.md}>
+ <Paragraph numberOfLines={1} color={colors.pri} size={SIZE.md}>
{item.title}
</Paragraph>
)}
</View>
</View>
-
- <View
- style={{
- backgroundColor:
- headerTextState?.id === item.id ? colors.accent : 'transparent',
- width: 7,
- height: 7,
- borderRadius: 100,
- ...getElevation(
- headerTextState?.id === item.id + '_navigation' ? 1 : 0,
- ),
- }}
- />
</PressableButton>
</>
);
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index b25bc4bfd..65f7394ba 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -89,6 +89,7 @@ export const Menu = React.memo(
style={{
height: '100%',
width: '100%',
+ paddingHorizontal:12
}}
showsVerticalScrollIndicator={false}
data={[0]}
@@ -108,7 +109,11 @@ export const Menu = React.memo(
</>
)}
/>
-
+ <View
+ style={{
+ paddingHorizontal:12
+ }}
+ >
{BottomItemsList.slice(DDS.isLargeTablet() ? 0 : 1, 2).map(
(item, index) => (
<MenuListItem
@@ -125,6 +130,8 @@ export const Menu = React.memo(
/>
),
)}
+ </View>
+
<View
style={{