Files
notesnook/apps/mobile/src/components/SimpleList/sectionheader.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-02-09 11:33:57 +05:00
import React from 'react';
2021-07-10 14:24:08 +05:00
import {TouchableOpacity, useWindowDimensions, View} from 'react-native';
import {useTracked} from '../../provider';
import {eSendEvent} from '../../services/EventManager';
import {eOpenJumpToDialog} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {HeaderMenu} from '../Header/HeaderMenu';
2021-02-09 11:33:57 +05:00
import Heading from '../Typography/Heading';
export const SectionHeader = ({
2021-06-08 12:26:55 +05:00
item,
index,
headerProps,
jumpToDialog,
sortMenuButton,
}) => {
const [state] = useTracked();
const {colors} = state;
const {fontScale} = useWindowDimensions();
2021-06-08 12:26:55 +05:00
return (
<View
style={{
flexDirection: 'row',
alignItems: 'center',
width: '100%',
justifyContent: 'space-between',
paddingHorizontal: 12,
2021-07-09 12:15:06 +05:00
height: 35 * fontScale,
2021-07-13 10:19:06 +05:00
backgroundColor:colors.nav,
2021-06-08 12:26:55 +05:00
}}>
<TouchableOpacity
onPress={() => {
2021-07-12 14:47:06 +05:00
eSendEvent(eOpenJumpToDialog);
2021-06-08 12:26:55 +05:00
}}
activeOpacity={0.9}
hitSlop={{top: 10, left: 10, right: 30, bottom: 15}}
style={{
height: '100%',
justifyContent: 'center',
}}>
<Heading
color={colors.accent}
size={SIZE.sm}
style={{
minWidth: 60,
alignSelf: 'center',
textAlignVertical: 'center',
}}>
{!item.title || item.title === '' ? 'Pinned' : item.title}
</Heading>
</TouchableOpacity>
2021-07-12 14:47:06 +05:00
{index === 0 ? <HeaderMenu /> : null}
2021-06-08 12:26:55 +05:00
</View>
);
};