Files
notesnook/apps/mobile/src/components/Header/HeaderLeftMenu.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-11-14 10:09:54 +05:00
import React from 'react';
2020-11-30 16:16:03 +05:00
import { notesnook } from '../../../e2e/test.ids';
2020-11-20 19:09:01 +05:00
import { useTracked } from '../../provider';
2020-11-26 16:22:32 +05:00
import Navigation from '../../services/Navigation';
2020-11-20 19:09:01 +05:00
import { SIZE } from '../../utils/SizeUtils';
import { ActionIcon } from '../ActionIcon';
2020-10-18 13:15:24 +05:00
export const HeaderLeftMenu = () => {
2020-11-04 20:29:45 +05:00
const [state] = useTracked();
const {colors, headerMenuState, currentScreen, deviceMode} = state;
2020-10-18 13:15:24 +05:00
2020-11-04 20:29:45 +05:00
const onLeftButtonPress = () => {
if (headerMenuState) {
2020-11-26 16:22:32 +05:00
Navigation.openDrawer()
2020-11-04 20:29:45 +05:00
return;
}
2020-11-26 16:22:32 +05:00
Navigation.goBack();
2020-11-04 20:29:45 +05:00
};
return (
<>
{deviceMode === 'mobile' || currentScreen === 'search' ? (
2020-11-04 20:29:45 +05:00
<ActionIcon
2020-11-30 16:16:03 +05:00
testID={notesnook.ids.default.header.buttons.left}
2020-11-04 20:29:45 +05:00
customStyle={{
justifyContent: 'center',
alignItems: 'center',
height: 40,
width: 40,
borderRadius: 100,
marginLeft: -5,
marginRight: 25,
}}
onPress={onLeftButtonPress}
2020-11-14 10:09:54 +05:00
name={!headerMenuState ? 'arrow-left' : 'menu'}
2020-11-04 20:29:45 +05:00
size={SIZE.xxxl}
color={colors.pri}
iconStyle={{
marginLeft: !headerMenuState ? -5 : 0,
}}
/>
) : undefined}
</>
);
2020-10-18 13:15:24 +05:00
};