fln-espranza 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -0
- package/components/Avatar.tsx +31 -0
- package/components/BaseLayout.tsx +174 -0
- package/components/Container.tsx +12 -0
- package/components/Drawer.tsx +93 -0
- package/components/EBadge.tsx +27 -0
- package/components/EButton.tsx +81 -0
- package/components/EButtonIcon.tsx +37 -0
- package/components/EDateAndTimeCard.tsx +43 -0
- package/components/EIcon.tsx +28 -0
- package/components/EInfoBox.tsx +41 -0
- package/components/EInput.tsx +55 -0
- package/components/ELabel.tsx +15 -0
- package/components/EOtpInputBox.tsx +49 -0
- package/components/EPageDescription.tsx +19 -0
- package/components/EPillButton.tsx +25 -0
- package/components/EProfile.tsx +43 -0
- package/components/ESegment.tsx +35 -0
- package/components/EText.tsx +41 -0
- package/components/ETimeLineCard.tsx +68 -0
- package/components/ListFormView.tsx +37 -0
- package/components/MenuItems.tsx +42 -0
- package/components/ModalLayout.tsx +81 -0
- package/components/PageHeader.tsx +139 -0
- package/components/PageHeaderSecondary.tsx +44 -0
- package/components/SecondaryBaseLayout.tsx +101 -0
- package/components/Spacer.tsx +13 -0
- package/components/Timer.tsx +57 -0
- package/components/index.tsx +61 -0
- package/lib/tailwind.js +8 -0
- package/package.json +23 -0
- package/utils/Color.ts +15 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { View, Image, TextInput, TextInputProps } from "react-native";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import EText from "./EText";
|
|
4
|
+
import tw from "../lib/tailwind";
|
|
5
|
+
import { AtSymbolIcon } from "react-native-heroicons/outline";
|
|
6
|
+
import { Colors } from "../utils/Color";
|
|
7
|
+
|
|
8
|
+
interface EInputProps extends TextInputProps {
|
|
9
|
+
label?: string;
|
|
10
|
+
icon?:string;
|
|
11
|
+
val?: string;
|
|
12
|
+
setVal?: any;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
reff?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function EOtpInput({label, icon,val,setVal, maxLength, reff, ...props }:EInputProps) {
|
|
18
|
+
const [hasFocus, setHasFocus] = useState(false);
|
|
19
|
+
return (
|
|
20
|
+
<View>
|
|
21
|
+
<EText size="sm" style={tw`font-bold opacity-50`}>
|
|
22
|
+
{label}
|
|
23
|
+
</EText>
|
|
24
|
+
<View
|
|
25
|
+
style={tw`bg-[${Colors["primary-light"]}] h-12 rounded-lg px-4 flex-row items-center border border-blue-100 ${
|
|
26
|
+
hasFocus ? `border-black bg-white shadow-lg shadow-blue-400` : ""
|
|
27
|
+
}`}
|
|
28
|
+
>
|
|
29
|
+
{icon ? <Image
|
|
30
|
+
source={icon}
|
|
31
|
+
style={[
|
|
32
|
+
tw`mr-2 opacity-40 ${hasFocus ? "opacity-100 tint-blue-700" : ""}`,
|
|
33
|
+
{ width: 24, height: 24 },
|
|
34
|
+
]}
|
|
35
|
+
/> : null}
|
|
36
|
+
<TextInput
|
|
37
|
+
{...props}
|
|
38
|
+
style={[tw`flex-1 text-base`, { lineHeight: 20 }]}
|
|
39
|
+
onFocus={() => setHasFocus(!hasFocus)}
|
|
40
|
+
onBlur={() => setHasFocus(!hasFocus)}
|
|
41
|
+
placeholderTextColor={"#AEB3BC"}
|
|
42
|
+
onChangeText={(val) => setVal(val)}
|
|
43
|
+
maxLength={maxLength}
|
|
44
|
+
ref={reff}
|
|
45
|
+
/>
|
|
46
|
+
</View>
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import tw from '../lib/tailwind'
|
|
3
|
+
import { Colors } from '../utils/Color';
|
|
4
|
+
import EText from './EText';
|
|
5
|
+
|
|
6
|
+
interface IProps{
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function EPageDescription({text}: IProps) {
|
|
11
|
+
return (
|
|
12
|
+
<EText
|
|
13
|
+
size='sm'
|
|
14
|
+
style={[tw`font-normal`, {color: Colors['text-body']}]}
|
|
15
|
+
>
|
|
16
|
+
{text}
|
|
17
|
+
</EText>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import tw from '../lib/tailwind'
|
|
4
|
+
import { Colors } from '../utils/Color';
|
|
5
|
+
import EText from './EText';
|
|
6
|
+
|
|
7
|
+
interface IProps {
|
|
8
|
+
title: string;
|
|
9
|
+
active?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function EPillButton( { title, active }: IProps) {
|
|
13
|
+
return (
|
|
14
|
+
// <TouchableOpacity style={tw`px-4 py-3 mr-3 border rounded-lg border-slate-300
|
|
15
|
+
// ${active ? "bg-purple-900 border-purple-900" : "border-slate-300"}`}>
|
|
16
|
+
<TouchableOpacity style={[tw`px-4 py-3 mr-2 border rounded-lg border-slate-300`, {
|
|
17
|
+
backgroundColor: active ? Colors['secondary-base'] : "transparent",
|
|
18
|
+
borderColor: active ? Colors['secondary-base'] : Colors['border'],
|
|
19
|
+
}]}>
|
|
20
|
+
<EText size={"sm"} style={tw`font-normal ${active ? "text-white" : "text-slate-500"}`}>
|
|
21
|
+
{title}
|
|
22
|
+
</EText>
|
|
23
|
+
</TouchableOpacity>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import tw from '../lib/tailwind';
|
|
4
|
+
import { Colors } from '../utils/Color';
|
|
5
|
+
import Avatar from './Avatar';
|
|
6
|
+
import EText from './EText';
|
|
7
|
+
|
|
8
|
+
interface IProps {
|
|
9
|
+
name: string;
|
|
10
|
+
subjectName: string;
|
|
11
|
+
border?: boolean;
|
|
12
|
+
children?: JSX.Element;
|
|
13
|
+
titleSize: string;
|
|
14
|
+
subTitleSize: string;
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function EProfile({ name, subjectName, border, children, titleSize, subTitleSize }: IProps) {
|
|
19
|
+
return (
|
|
20
|
+
<View style={[tw`flex-row items-center justify-between py-3 ${border ? "border-b" : ""}`, {borderBottomColor: Colors.border}]}>
|
|
21
|
+
<View style={tw`flex-row items-center`}>
|
|
22
|
+
<Avatar
|
|
23
|
+
size="sm"
|
|
24
|
+
source={""}
|
|
25
|
+
nameFirstLetter={"J"}
|
|
26
|
+
bg={"sky-400"}
|
|
27
|
+
/>
|
|
28
|
+
<View style={tw`ml-3`}>
|
|
29
|
+
<EText style={[tw`${titleSize}`, { color: Colors['text-primary'] }]}>{name}</EText>
|
|
30
|
+
<EText style={[tw`mt-1 ${subTitleSize}`, { color: Colors['text-body'] }]}>
|
|
31
|
+
{subjectName}
|
|
32
|
+
</EText>
|
|
33
|
+
</View>
|
|
34
|
+
</View>
|
|
35
|
+
{
|
|
36
|
+
children ? <>
|
|
37
|
+
{children}
|
|
38
|
+
</> : null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
</View>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { View, Text, Pressable, TouchableOpacity } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import tw from '../lib/tailwind'
|
|
4
|
+
import EText from "./EText";
|
|
5
|
+
import { Colors } from "../utils/Color";
|
|
6
|
+
|
|
7
|
+
export function ESegmentItem(props: any) {
|
|
8
|
+
const { onPress, label, isActive } = props;
|
|
9
|
+
return (
|
|
10
|
+
<TouchableOpacity
|
|
11
|
+
style={tw.style(
|
|
12
|
+
"py-1.5 px-4 rounded items-center w-1/2",
|
|
13
|
+
isActive && "bg-white shadow-lg shadow-slate-500 "
|
|
14
|
+
)}
|
|
15
|
+
>
|
|
16
|
+
<View style={tw`items-center`}>
|
|
17
|
+
<EText size="xs" style={tw`font-bold ${!isActive ? "text-white": ""}`}>{label}</EText>
|
|
18
|
+
</View>
|
|
19
|
+
</TouchableOpacity>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function ESegment(props: any) {
|
|
24
|
+
return (
|
|
25
|
+
<View style={tw`justify-center items-center`}>
|
|
26
|
+
<View
|
|
27
|
+
style={[tw`flex-row rounded-md p-0.5 border border-slate-100 w-full`, {
|
|
28
|
+
backgroundColor: Colors["text-body"],
|
|
29
|
+
}]}
|
|
30
|
+
>
|
|
31
|
+
{props.children}
|
|
32
|
+
</View>
|
|
33
|
+
</View>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Text, TextProps } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import tw from "../lib/tailwind";
|
|
4
|
+
|
|
5
|
+
interface ETextProps extends TextProps {
|
|
6
|
+
size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "title";
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
style?: any;
|
|
9
|
+
children: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function EText({
|
|
13
|
+
size,
|
|
14
|
+
muted,
|
|
15
|
+
style,
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}: ETextProps) {
|
|
19
|
+
return (
|
|
20
|
+
<Text
|
|
21
|
+
{...props}
|
|
22
|
+
style={[
|
|
23
|
+
tw.style(
|
|
24
|
+
"text-base leading-6",
|
|
25
|
+
size === "xs" && "text-xs",
|
|
26
|
+
size === "sm" && "text-sm",
|
|
27
|
+
size === "base" && "text-base",
|
|
28
|
+
size == "lg" && "font-semibold text-lg",
|
|
29
|
+
size === "xl" && "font-bold text-xl",
|
|
30
|
+
size === "2xl" && "font-bold text-2xl",
|
|
31
|
+
size === "3xl" && "font-bold text-3xl",
|
|
32
|
+
size === "title" && "font-extrabold text-title text-2xl",
|
|
33
|
+
muted && "opacity-40"
|
|
34
|
+
),
|
|
35
|
+
style,
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</Text>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Dimensions, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { ChevronRightIcon } from 'react-native-heroicons/solid';
|
|
4
|
+
import tw from '../lib/tailwind'
|
|
5
|
+
import { Colors } from '../utils/Color';
|
|
6
|
+
import EBadge from './EBadge'
|
|
7
|
+
import EButton from './EButton';
|
|
8
|
+
import EDateAndTimeCard from './EDateAndTimeCard'
|
|
9
|
+
import EText from './EText'
|
|
10
|
+
|
|
11
|
+
interface IProps {
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
completed: boolean;
|
|
15
|
+
skipButton?: boolean;
|
|
16
|
+
onPress?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function ETimeLineCard({ title, description, completed, skipButton, onPress }: IProps) {
|
|
20
|
+
return (
|
|
21
|
+
<TouchableOpacity
|
|
22
|
+
onPress={() => onPress && onPress()}
|
|
23
|
+
style={[
|
|
24
|
+
tw` rounded-lg p-4 mb-3 w-full border border}`,
|
|
25
|
+
{
|
|
26
|
+
backgroundColor: completed ? Colors['primary-light'] : Colors['white'],
|
|
27
|
+
borderColor: completed ? Colors['primary-base'] : Colors['border'],
|
|
28
|
+
}
|
|
29
|
+
]}
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
<View style={tw`flex-row justify-between `}>
|
|
33
|
+
<View style={tw`flex-1`}>
|
|
34
|
+
<EText size="base" style={[tw`font-bold`, { color: Colors['text-primary'] }]}>
|
|
35
|
+
{title}
|
|
36
|
+
</EText>
|
|
37
|
+
<EText size='xs' muted style={[tw`font-normal mt-1`, {color: Colors['text-body']}]}>
|
|
38
|
+
{description}
|
|
39
|
+
</EText>
|
|
40
|
+
</View>
|
|
41
|
+
<View style={tw`ml-4`}>
|
|
42
|
+
<ChevronRightIcon style={[tw``,{ color: Colors['text-body']}]} size={20} />
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
|
|
46
|
+
<View style={tw`mt-6 flex-row items-center justify-between`}>
|
|
47
|
+
<EBadge
|
|
48
|
+
completed={completed}
|
|
49
|
+
text={completed ? "Complete" : "Pending"}
|
|
50
|
+
color={completed ? Colors['primary-base'] : Colors.warning}
|
|
51
|
+
textColor={completed ? "text-white" : ""}
|
|
52
|
+
size="xs"
|
|
53
|
+
padding='py-1 px-3'
|
|
54
|
+
fontWeight='font-bold'
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
skipButton ? (
|
|
59
|
+
<TouchableOpacity>
|
|
60
|
+
<EText size="sm" style={[tw`ml-2 font-semibold`, {color: Colors['primary-base']}]}>
|
|
61
|
+
Skip
|
|
62
|
+
</EText>
|
|
63
|
+
</TouchableOpacity>) : null
|
|
64
|
+
}
|
|
65
|
+
</View>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
View,
|
|
3
|
+
Text,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
Image,
|
|
6
|
+
TouchableOpacityProps,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import tw from "../lib/tailwind";
|
|
10
|
+
import EText from "./EText";
|
|
11
|
+
import { Colors } from "../utils/Color";
|
|
12
|
+
// import { Tag } from "..";
|
|
13
|
+
|
|
14
|
+
interface ListFormViewProps {
|
|
15
|
+
label: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function ListFormView({
|
|
20
|
+
label,
|
|
21
|
+
description,
|
|
22
|
+
}: ListFormViewProps) {
|
|
23
|
+
return (
|
|
24
|
+
<View style={tw`flex-row items-center justify-between py-3 border-b border-[${Colors.border}]`}>
|
|
25
|
+
<View style={tw``}>
|
|
26
|
+
<EText size="sm" style={tw`font-normal text-[${Colors["text-secondary"]}]`}>
|
|
27
|
+
{label}
|
|
28
|
+
</EText>
|
|
29
|
+
</View>
|
|
30
|
+
<View style={tw`flex-1 ml-4 items-end`}>
|
|
31
|
+
<EText size="sm" style={tw`font-normal text-[${Colors["text-primary"]}]`}>
|
|
32
|
+
{description}
|
|
33
|
+
</EText>
|
|
34
|
+
</View>
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import { HomeIcon } from 'react-native-heroicons/solid'
|
|
4
|
+
import tw from '../lib/tailwind'
|
|
5
|
+
import { Colors } from '../utils/Color'
|
|
6
|
+
import EText from './EText'
|
|
7
|
+
|
|
8
|
+
interface IProps {
|
|
9
|
+
title?: string
|
|
10
|
+
icon?: JSX.Element
|
|
11
|
+
onPress?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function MenuItems( { title, icon, onPress }: IProps ) {
|
|
15
|
+
return (
|
|
16
|
+
<TouchableOpacity style={tw`flex-row items-center` } onPress={onPress}>
|
|
17
|
+
{/* <HomeIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} /> */}
|
|
18
|
+
{
|
|
19
|
+
icon ?
|
|
20
|
+
icon
|
|
21
|
+
:
|
|
22
|
+
<HomeIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />
|
|
23
|
+
}
|
|
24
|
+
<View style={[tw`py-4 ml-4 mr-8 w-[80%]`, {
|
|
25
|
+
borderBottomWidth: 1,
|
|
26
|
+
borderBottomColor: Colors.border,
|
|
27
|
+
}]}>
|
|
28
|
+
<EText size="sm" style={[tw`font-medium `, {
|
|
29
|
+
color: Colors["text-primary"]
|
|
30
|
+
}]}>
|
|
31
|
+
{/* {"Dashboard"} */}
|
|
32
|
+
{
|
|
33
|
+
title ?
|
|
34
|
+
title
|
|
35
|
+
:
|
|
36
|
+
"Dashboard"
|
|
37
|
+
}
|
|
38
|
+
</EText>
|
|
39
|
+
</View>
|
|
40
|
+
</TouchableOpacity>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
View,
|
|
3
|
+
Dimensions,
|
|
4
|
+
ScrollView,
|
|
5
|
+
Platform,
|
|
6
|
+
} from "react-native";
|
|
7
|
+
import React, { } from "react";
|
|
8
|
+
import Constants from "expo-constants";
|
|
9
|
+
import tw from "../lib/tailwind";
|
|
10
|
+
import EButtonIcon from "./EButtonIcon";
|
|
11
|
+
import { StatusBar } from "expo-status-bar";
|
|
12
|
+
import PageHeaderSecondary from "./PageHeaderSecondary";
|
|
13
|
+
import { useNavigation } from "@react-navigation/native";
|
|
14
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
15
|
+
import { Container } from ".";
|
|
16
|
+
|
|
17
|
+
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
18
|
+
const SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
19
|
+
const HEADER_HEIGHT = Constants.statusBarHeight + 60;
|
|
20
|
+
const SCROLL_PADDING_BOTTOM = 100;
|
|
21
|
+
|
|
22
|
+
interface ModalLayoutProps {
|
|
23
|
+
title: string;
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
children?: JSX.Element;
|
|
26
|
+
bottomButton?: JSX.Element;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function ModalLayout({
|
|
30
|
+
title,
|
|
31
|
+
subtitle,
|
|
32
|
+
children,
|
|
33
|
+
bottomButton,
|
|
34
|
+
}: ModalLayoutProps) {
|
|
35
|
+
const insets = useSafeAreaInsets();
|
|
36
|
+
const navigation = useNavigation();
|
|
37
|
+
return (
|
|
38
|
+
<View style={[tw`flex-1 bg-white`, {}]}>
|
|
39
|
+
<StatusBar
|
|
40
|
+
style={Platform.OS === "android" ? "dark" : "light"}
|
|
41
|
+
animated
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
{/* HEADER */}
|
|
45
|
+
<View
|
|
46
|
+
style={[
|
|
47
|
+
tw`absolute top-0 right-0 left-0 px-6 pr-3 pt-2 z-10 w-full bg-white ${title ? 'pb-1' : 'pb-0'}`,
|
|
48
|
+
// {height: 64},
|
|
49
|
+
]}
|
|
50
|
+
>
|
|
51
|
+
<PageHeaderSecondary
|
|
52
|
+
title={title}
|
|
53
|
+
subtitle={subtitle}
|
|
54
|
+
button={
|
|
55
|
+
<EButtonIcon
|
|
56
|
+
type="close"
|
|
57
|
+
iconColor="slate-800"
|
|
58
|
+
onPress={() => navigation.goBack()}
|
|
59
|
+
/>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
<ScrollView
|
|
64
|
+
style={[
|
|
65
|
+
tw`flex-1`,
|
|
66
|
+
{ paddingBottom: insets.bottom, paddingTop: title ? 80 : 56 },
|
|
67
|
+
]}
|
|
68
|
+
showsVerticalScrollIndicator={false}
|
|
69
|
+
decelerationRate={"fast"}
|
|
70
|
+
contentContainerStyle={{
|
|
71
|
+
paddingBottom: SCROLL_PADDING_BOTTOM,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
</ScrollView>
|
|
76
|
+
{bottomButton ? <View style={tw` px-6 mb-4 `}>
|
|
77
|
+
{bottomButton}
|
|
78
|
+
</View> : <></>}
|
|
79
|
+
</View>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { View, Animated, Dimensions, Image } from "react-native";
|
|
2
|
+
import React, { useEffect, useRef } from "react";
|
|
3
|
+
import tw from "../lib/tailwind";
|
|
4
|
+
import { useNavigation } from "@react-navigation/native";
|
|
5
|
+
import EButtonIcon from "./EButtonIcon";
|
|
6
|
+
import EText from "./EText";
|
|
7
|
+
import Constants from "expo-constants";
|
|
8
|
+
import { MenuIcon } from "react-native-heroicons/outline";
|
|
9
|
+
|
|
10
|
+
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
11
|
+
const HEADER_HEIGHT = 90;
|
|
12
|
+
|
|
13
|
+
interface PageHeaderProps {
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
curved?: boolean;
|
|
17
|
+
children?: JSX.Element;
|
|
18
|
+
iconEnd?: JSX.Element;
|
|
19
|
+
border?: boolean;
|
|
20
|
+
menuButton?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function PageHeader({
|
|
24
|
+
title,
|
|
25
|
+
subtitle,
|
|
26
|
+
curved,
|
|
27
|
+
children,
|
|
28
|
+
iconEnd,
|
|
29
|
+
border,
|
|
30
|
+
menuButton,
|
|
31
|
+
}: PageHeaderProps) {
|
|
32
|
+
const navigation = useNavigation();
|
|
33
|
+
|
|
34
|
+
const translateX = useRef(new Animated.Value(60)).current;
|
|
35
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
Animated.spring(translateX, {
|
|
39
|
+
toValue: 0,
|
|
40
|
+
stiffness: 40,
|
|
41
|
+
damping: 10,
|
|
42
|
+
useNativeDriver: true,
|
|
43
|
+
}).start();
|
|
44
|
+
Animated.spring(opacity, {
|
|
45
|
+
toValue: 1,
|
|
46
|
+
delay: 250,
|
|
47
|
+
useNativeDriver: true,
|
|
48
|
+
}).start();
|
|
49
|
+
});
|
|
50
|
+
return (
|
|
51
|
+
<View style={[tw`${curved ? "-mb-2" : ""} ${border ? "border-b border-slate-300" : ""} `, {}]}>
|
|
52
|
+
<View style={tw`overflow-hidden`}>
|
|
53
|
+
{curved ? (
|
|
54
|
+
<Image
|
|
55
|
+
resizeMode="cover"
|
|
56
|
+
// source={require("../assets/images/bg-header.jpg")}
|
|
57
|
+
style={[
|
|
58
|
+
tw`absolute w-full h-full`,
|
|
59
|
+
{ width: SCREEN_WIDTH, borderBottomRightRadius: 32 },
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
) : null}
|
|
63
|
+
<Animated.View
|
|
64
|
+
style={[
|
|
65
|
+
tw`flex-row pr-4 pl-3 pb-3`,
|
|
66
|
+
{
|
|
67
|
+
paddingTop: Constants.statusBarHeight + 8,
|
|
68
|
+
transform: [{ translateX }],
|
|
69
|
+
opacity,
|
|
70
|
+
},
|
|
71
|
+
]}
|
|
72
|
+
>
|
|
73
|
+
<Animated.View
|
|
74
|
+
style={[tw`-mt-2 left-3 absolute `, { transform: [{ translateX }], opacity, paddingTop: Constants.statusBarHeight + 8 }]}
|
|
75
|
+
>
|
|
76
|
+
{menuButton ?
|
|
77
|
+
<MenuIcon
|
|
78
|
+
onPress={() => navigation?.openDrawer()}
|
|
79
|
+
size={20}
|
|
80
|
+
// onPress={() => navigation.navigate("Dashboard")}
|
|
81
|
+
style={tw`text-slate-900 mt-2`}
|
|
82
|
+
/>
|
|
83
|
+
:
|
|
84
|
+
|
|
85
|
+
<EButtonIcon
|
|
86
|
+
iconColor={curved ? "white" : "tint-slate-900"}
|
|
87
|
+
size={20}
|
|
88
|
+
// onPress={() => navigation.navigate("Dashboard")}
|
|
89
|
+
onPress={() => navigation.goBack()}
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
</Animated.View>
|
|
93
|
+
<View style={tw`flex-1 items-center`}>
|
|
94
|
+
<EText
|
|
95
|
+
size="sm"
|
|
96
|
+
style={tw.style("text-black font-semibold ", curved && "text-white ")}
|
|
97
|
+
>
|
|
98
|
+
{title}
|
|
99
|
+
</EText>
|
|
100
|
+
{subtitle ? (
|
|
101
|
+
<EText
|
|
102
|
+
style={tw.style(
|
|
103
|
+
"text-slate-800 opacity-40 font-semibold mt-0.25",
|
|
104
|
+
curved && "text-white "
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
{subtitle}
|
|
108
|
+
</EText>
|
|
109
|
+
) : null}
|
|
110
|
+
</View>
|
|
111
|
+
|
|
112
|
+
{iconEnd ? (
|
|
113
|
+
<View style={[tw`mt-0.5 items-center justify-center`, {}]}>
|
|
114
|
+
{iconEnd}
|
|
115
|
+
</View>
|
|
116
|
+
) : null}
|
|
117
|
+
</Animated.View>
|
|
118
|
+
{children ? <View style={tw.style("pb-6")}>{children}</View> : null}
|
|
119
|
+
</View>
|
|
120
|
+
|
|
121
|
+
{/* MASK */}
|
|
122
|
+
{curved ? (
|
|
123
|
+
<View
|
|
124
|
+
style={[
|
|
125
|
+
tw``,
|
|
126
|
+
{ height: 32, width: SCREEN_WIDTH, backgroundColor: "#0547FA" },
|
|
127
|
+
]}
|
|
128
|
+
>
|
|
129
|
+
<View
|
|
130
|
+
style={[
|
|
131
|
+
tw`bg-white -z-0`,
|
|
132
|
+
{ height: 64, width: SCREEN_WIDTH, borderTopLeftRadius: 32 },
|
|
133
|
+
]}
|
|
134
|
+
/>
|
|
135
|
+
</View>
|
|
136
|
+
) : null}
|
|
137
|
+
</View>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { View, Text, Platform } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import tw from "../lib/tailwind";
|
|
4
|
+
import EText from "./EText";
|
|
5
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
+
|
|
7
|
+
interface PageHeaderSecondaryProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
button?: JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export default function PageHeaderSecondary({
|
|
13
|
+
title,
|
|
14
|
+
subtitle,
|
|
15
|
+
button,
|
|
16
|
+
}: PageHeaderSecondaryProps) {
|
|
17
|
+
const insets = useSafeAreaInsets();
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
style={[
|
|
21
|
+
tw`flex-row justify-between items-center bg-white`,
|
|
22
|
+
{
|
|
23
|
+
paddingTop: Platform.OS === "android" ? insets.top + 8 : 8,
|
|
24
|
+
},
|
|
25
|
+
]}
|
|
26
|
+
>
|
|
27
|
+
<View style={tw` flex-1 justify-center items-center`}>
|
|
28
|
+
{title ? (
|
|
29
|
+
<EText size="base" style={tw`font-semibold`}>
|
|
30
|
+
{title}
|
|
31
|
+
</EText>
|
|
32
|
+
) : null}
|
|
33
|
+
{subtitle ? (
|
|
34
|
+
<EText muted style={tw`mt-0.25 font-semibold`}>
|
|
35
|
+
{subtitle}
|
|
36
|
+
</EText>
|
|
37
|
+
) : null}
|
|
38
|
+
</View>
|
|
39
|
+
<View style={[tw`absolute right-3`, {
|
|
40
|
+
paddingTop: Platform.OS === "android" ? insets.top + 8 : 8,
|
|
41
|
+
}]}>{button}</View>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
}
|