mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react'
2import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'
3
4import {atoms as a, useTheme} from '#/alf'
5import {Text} from '#/components/Typography'
6
7export function Header({
8 renderLeft,
9 renderRight,
10 children,
11 style,
12}: {
13 renderLeft?: () => React.ReactNode
14 renderRight?: () => React.ReactNode
15 children?: React.ReactNode
16 style?: StyleProp<ViewStyle>
17}) {
18 const t = useTheme()
19 return (
20 <View
21 style={[
22 a.relative,
23 a.w_full,
24 a.py_sm,
25 a.flex_row,
26 a.justify_center,
27 a.align_center,
28 {minHeight: 50},
29 a.border_b,
30 t.atoms.border_contrast_medium,
31 t.atoms.bg,
32 {borderTopLeftRadius: a.rounded_md.borderRadius},
33 {borderTopRightRadius: a.rounded_md.borderRadius},
34 style,
35 ]}>
36 {renderLeft && (
37 <View style={[a.absolute, {left: 6}]}>{renderLeft()}</View>
38 )}
39 {children}
40 {renderRight && (
41 <View style={[a.absolute, {right: 6}]}>{renderRight()}</View>
42 )}
43 </View>
44 )
45}
46
47export function HeaderText({
48 children,
49 style,
50}: {
51 children?: React.ReactNode
52 style?: StyleProp<TextStyle>
53}) {
54 return (
55 <Text style={[a.text_lg, a.text_center, a.font_bold, style]}>
56 {children}
57 </Text>
58 )
59}