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

83 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-09-27 13:05:26 +05:00
import React from 'react';
2022-01-22 12:57:05 +05:00
import { Text } from 'react-native';
import { View } from 'react-native';
2022-02-28 23:25:18 +05:00
import { useThemeStore } from '../../stores/theme';
2022-02-28 13:48:59 +05:00
import { SIZE } from '../../utils/size';
import { Button } from '../ui/button';
import Heading from '../ui/typography/heading';
import Paragraph from '../ui/typography/paragraph';
2020-09-27 13:05:26 +05:00
2021-11-15 15:25:36 +05:00
const DialogHeader = ({
icon,
title,
paragraph,
button,
paragraphColor,
padding,
centered,
titlePart
}) => {
2022-02-28 23:25:18 +05:00
const colors = useThemeStore(state => state.colors);
2020-09-27 13:05:26 +05:00
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',
minHeight: 50,
2021-11-15 15:25:36 +05:00
paddingHorizontal: padding
2022-01-22 12:57:05 +05:00
}}
>
2020-12-19 13:15:34 +05:00
<View
style={{
width: '100%'
2022-01-22 12:57:05 +05:00
}}
>
2020-12-17 11:13:04 +05:00
<View
style={{
flexDirection: 'row',
2021-11-15 15:25:36 +05:00
justifyContent: centered ? 'center' : 'space-between',
alignItems: 'center'
2022-01-22 12:57:05 +05:00
}}
>
2021-11-15 15:25:36 +05:00
<Heading size={SIZE.xl}>
2022-01-22 12:57:05 +05:00
{title} {titlePart ? <Text style={{ color: colors.accent }}>{titlePart}</Text> : null}
2021-11-15 15:25:36 +05:00
</Heading>
2020-12-17 11:13:04 +05:00
2021-09-13 08:53:16 +05:00
{button ? (
2020-12-17 11:13:04 +05:00
<Button
onPress={button.onPress}
style={{
borderRadius: 100,
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}
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-11-15 15:25:36 +05:00
<Paragraph
style={{
textAlign: centered ? 'center' : 'left',
maxWidth: centered ? '90%' : '100%',
alignSelf: centered ? 'center' : 'flex-start'
}}
2022-01-22 12:57:05 +05:00
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;