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
|
|
|
|
2021-06-07 08:24:38 +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',
|
2021-10-22 15:41:45 +05:00
|
|
|
minHeight: 50
|
2020-09-27 13:05:26 +05:00
|
|
|
}}>
|
2020-12-19 13:15:34 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
2021-10-22 15:41:45 +05:00
|
|
|
width: '100%'
|
2020-12-19 13:15:34 +05:00
|
|
|
}}>
|
2020-12-17 11:13:04 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
justifyContent: 'space-between',
|
2021-10-22 15:41:45 +05:00
|
|
|
alignItems: 'center'
|
2020-12-17 11:13:04 +05:00
|
|
|
}}>
|
|
|
|
|
<Heading size={SIZE.xl}>{title}</Heading>
|
|
|
|
|
|
2021-09-13 08:53:16 +05:00
|
|
|
{button ? (
|
2020-12-17 11:13:04 +05:00
|
|
|
<Button
|
|
|
|
|
onPress={button.onPress}
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 100,
|
2021-10-22 15:41:45 +05:00
|
|
|
paddingHorizontal: 12
|
2020-12-17 11:13:04 +05:00
|
|
|
}}
|
2021-06-02 17:34:39 +05:00
|
|
|
fontSize={13}
|
2020-12-17 11:13:04 +05:00
|
|
|
title={button.title}
|
2021-10-22 15:41:45 +05:00
|
|
|
type={button.type || 'grayBg'}
|
2021-06-02 17:34:39 +05:00
|
|
|
height={25}
|
2020-12-17 11:13:04 +05:00
|
|
|
/>
|
2021-09-13 08:53:16 +05:00
|
|
|
) : null}
|
2020-12-17 11:13:04 +05:00
|
|
|
</View>
|
|
|
|
|
|
2020-11-23 15:57:31 +05:00
|
|
|
{paragraph ? (
|
2021-06-07 08:24:38 +05:00
|
|
|
<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;
|