Files
notesnook/apps/mobile/src/components/Dialog/DialogHeader.js

60 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-09-27 13:05:26 +05:00
import React from 'react';
2020-11-23 15:57:31 +05:00
import {View} from 'react-native';
2020-09-27 13:05:26 +05:00
import {useTracked} from '../../provider';
2020-11-23 15:57:31 +05:00
import {SIZE} from '../../utils/SizeUtils';
import {Button} from '../Button';
2020-11-20 01:23:05 +05:00
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
2020-09-27 13:05:26 +05:00
const DialogHeader = ({icon, title, paragraph, button, paragraphColor}) => {
2020-09-27 13:05:26 +05:00
const [state, dispatch] = useTracked();
const colors = state.colors;
return (
2020-09-27 13:14:24 +05:00
<>
<View
2020-09-27 13:05:26 +05:00
style={{
2020-09-27 13:14:24 +05:00
flexDirection: 'row',
alignItems: 'center',
2020-11-23 15:57:31 +05:00
justifyContent: 'space-between',
2020-12-22 00:25:58 +05:00
minHeight: 50,
2020-09-27 13:05:26 +05:00
}}>
2020-12-19 13:15:34 +05:00
<View
style={{
width: '100%',
}}>
2020-12-17 11:13:04 +05:00
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
}}>
<Heading size={SIZE.xl}>{title}</Heading>
{button && (
<Button
onPress={button.onPress}
style={{
borderRadius: 100,
}}
2021-06-02 17:34:39 +05:00
fontSize={13}
2020-12-17 11:13:04 +05:00
title={button.title}
type="accent"
2021-06-02 17:34:39 +05:00
height={25}
2020-12-17 11:13:04 +05:00
/>
)}
</View>
2020-11-23 15:57:31 +05:00
{paragraph ? (
<Paragraph color={paragraphColor || colors.icon}>
{paragraph}
</Paragraph>
2020-11-23 15:57:31 +05:00
) : null}
</View>
</View>
2020-09-27 13:14:24 +05:00
</>
2020-09-27 13:05:26 +05:00
);
};
2020-09-27 13:14:24 +05:00
export default DialogHeader;