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 ADDED
@@ -0,0 +1 @@
1
+ # All components which is used to develop the FLN-Espranza Project.
@@ -0,0 +1,31 @@
1
+ import { View, Image, ImageProps } from "react-native";
2
+ import React from "react";
3
+ import tw from "../lib/tailwind";
4
+ import EText from "./EText";
5
+
6
+ interface AvatarProps {
7
+ size?: "xxs" | "xs" | "sm" | "lg" | "5xl";
8
+ source: string;
9
+ nameFirstLetter?: string;
10
+ bg?: string;
11
+ textColor?: string;
12
+ }
13
+
14
+ export default function Avatar({ size, source, nameFirstLetter, bg, textColor }: AvatarProps) {
15
+ return (
16
+ <View
17
+ style={tw.style(
18
+ "flex items-center justify-center w-16 h-16 rounded-full overflow-hidden",
19
+ size === "lg" && "w-16 h-16",
20
+ size === "sm" && "w-12 h-12",
21
+ size === "xs" && "w-10 h-10",
22
+ size === "xxs" && "w-7 h-7",
23
+ size === "5xl" && "w-20 h-20",
24
+ bg ? `bg-${bg}` : "bg-gray-200"
25
+ )}
26
+ >
27
+ {source ? <Image style={tw`w-full h-full `} source={source} /> :
28
+ <EText style={tw`text-2xl font-extrabold text-white`}>{nameFirstLetter}</EText>}
29
+ </View>
30
+ );
31
+ }
@@ -0,0 +1,174 @@
1
+ import { View, ImageBackground, Dimensions, Animated } from "react-native";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import tw from "../lib/tailwind";
5
+ import EText from "./EText";
6
+ import { StatusBar } from "expo-status-bar";
7
+ import { Container, EButton, EButtonIcon, PageHeader } from ".";
8
+ import Constants from "expo-constants";
9
+ import { useNavigation } from "@react-navigation/native";
10
+
11
+ const SCREEN_WIDTH = Dimensions.get("window").width;
12
+ const SCREEN_HEIGHT = Dimensions.get("window").height;
13
+ const HEADER_HEIGHT = Constants.statusBarHeight + 60;
14
+ const SCROLL_PADDING_BOTTOM = 100;
15
+
16
+ interface BaseLayoutProps {
17
+ title: string;
18
+ subtitle?: string;
19
+ curved?: boolean;
20
+ headerContent?: JSX.Element;
21
+ children?: JSX.Element;
22
+ iconEnd?: JSX.Element;
23
+ noScroll?: boolean;
24
+ bottomButton?: JSX.Element;
25
+ border?: boolean;
26
+ menuButton?: boolean;
27
+ }
28
+
29
+ export default function BaseLayout({
30
+ title,
31
+ subtitle,
32
+ curved,
33
+ headerContent,
34
+ children,
35
+ noScroll,
36
+ iconEnd,
37
+ bottomButton,
38
+ border,
39
+ menuButton,
40
+ }: BaseLayoutProps) {
41
+ const insets = useSafeAreaInsets();
42
+ const [headerScrolled, setHeaderScrolled] = useState(false);
43
+ const scrollY = useRef(new Animated.Value(0)).current;
44
+ const opacity = useRef(new Animated.Value(0)).current;
45
+
46
+ useEffect(() => {
47
+ Animated.spring(scrollY, {
48
+ toValue: headerScrolled ? 0 : -40,
49
+ speed: 2,
50
+ delay: 1,
51
+ bounciness: 1,
52
+ useNativeDriver: true,
53
+ }).start();
54
+
55
+ Animated.spring(opacity, {
56
+ toValue: headerScrolled ? 0.975 : 0,
57
+ speed: 2,
58
+ delay: 1,
59
+ bounciness: 1,
60
+ useNativeDriver: true,
61
+ }).start();
62
+ }, [headerScrolled]);
63
+
64
+ const navigation = useNavigation();
65
+
66
+ return (
67
+ <View
68
+ style={[
69
+ tw`flex-1 bg-white`,
70
+ {
71
+ paddingBottom: noScroll ? 0 : insets.bottom,
72
+ },
73
+ ]}
74
+ >
75
+ <StatusBar
76
+ style={headerScrolled ? "light" : curved ? "light" : "dark"}
77
+ animated
78
+ />
79
+ {/* COLLAPSED HEADER */}
80
+ <Animated.View
81
+ style={[
82
+ tw`absolute top-0 left-0 right-0 bg-white z-10 shadow-2xl`,
83
+ {
84
+ transform: [{ translateY: scrollY }],
85
+ opacity,
86
+ },
87
+ ]}
88
+ >
89
+ <ImageBackground
90
+ style={[tw`flex-1`, {}]}
91
+ source={require("../assets/images/bg-header.jpg")}
92
+ >
93
+ <View
94
+ style={[
95
+ tw`flex-1 pl-3 pb-3 flex-row items-center`,
96
+ { paddingTop: Constants.statusBarHeight + 4 },
97
+ ]}
98
+ >
99
+ <EButtonIcon
100
+ iconColor={"white"}
101
+ size={20}
102
+ onPress={() => navigation.goBack()}
103
+ />
104
+ <View style={tw`ml-2`}>
105
+ <EText size="base" style={tw`font-semibold text-white mb-0.5`}>
106
+ {title}
107
+ </EText>
108
+ {subtitle ? (
109
+ <EText
110
+ size="xs"
111
+ style={tw`font-semibold text-white opacity-40`}
112
+ >
113
+ {subtitle}
114
+ </EText>
115
+ ) : null}
116
+ </View>
117
+ </View>
118
+ </ImageBackground>
119
+ </Animated.View>
120
+
121
+ {noScroll ? (
122
+ <View style={tw`flex-1`}>
123
+ <PageHeader
124
+ title={title}
125
+ subtitle={subtitle}
126
+ curved={curved}
127
+ iconEnd={iconEnd}
128
+ >
129
+ {headerContent}
130
+ </PageHeader>
131
+ {children}
132
+ </View>
133
+ ) : (
134
+ <Animated.ScrollView
135
+ onScroll={(event) => {
136
+ const scrolling = event.nativeEvent.contentOffset.y;
137
+ scrolling > 60 ? setHeaderScrolled(true) : setHeaderScrolled(false);
138
+ }}
139
+ style={[
140
+ tw`flex-1`,
141
+ { minHeight: SCREEN_HEIGHT, paddingBottom: SCROLL_PADDING_BOTTOM },
142
+ ]}
143
+ scrollEventThrottle={16}
144
+ showsVerticalScrollIndicator={false}
145
+ decelerationRate={"fast"}
146
+ // fadingEdgeLength={1s00}
147
+ // alwaysBounceVertical={false}
148
+ contentContainerStyle={{
149
+ paddingBottom: SCROLL_PADDING_BOTTOM,
150
+ }}
151
+ >
152
+ <PageHeader
153
+ menuButton={menuButton}
154
+ title={title}
155
+ subtitle={subtitle}
156
+ curved={curved}
157
+ iconEnd={iconEnd}
158
+ border={border}
159
+ >
160
+ {headerContent}
161
+ </PageHeader>
162
+ {children}
163
+ </Animated.ScrollView>
164
+ )}
165
+ {bottomButton ? (
166
+ <Container style={tw`flex-1 justify-end mb-4 `}>
167
+ {bottomButton}
168
+ </Container>
169
+ ) : (
170
+ <></>
171
+ )}
172
+ </View>
173
+ );
174
+ }
@@ -0,0 +1,12 @@
1
+ import { View, Text } from "react-native";
2
+ import React from "react";
3
+ import tw from "../lib/tailwind";
4
+
5
+ export default function Container(props: any) {
6
+ const { fullWidth, style } = props;
7
+ return (
8
+ <View style={tw.style("flex-1 px-4 ", fullWidth && "px-0 ", style)}>
9
+ {props.children}
10
+ </View>
11
+ );
12
+ }
@@ -0,0 +1,93 @@
1
+ import React from "react";
2
+ import { ScrollView, View, TouchableOpacity } from "react-native";
3
+ import { HomeIcon,CalendarIcon, TemplateIcon, ViewBoardsIcon } from 'react-native-heroicons/solid';
4
+ import { StyleSheet } from 'react-native';
5
+ import tw from "../lib/tailwind";
6
+ import EText from "./EText";
7
+ import Spacer from "./Spacer";
8
+ import Avatar from "./Avatar";
9
+ import { Colors } from "../utils/Color";
10
+ import MenuItems from "./MenuItems";
11
+
12
+ const Drawer = ({ navigation }: any) => {
13
+ return (
14
+ <ScrollView
15
+ scrollEnabled={true}
16
+ showsVerticalScrollIndicator={false}
17
+ style={{
18
+ position: 'relative',
19
+ backgroundColor: '#fff',
20
+ }}>
21
+ <View style={tw`mx-4`}>
22
+ <Spacer height={30} />
23
+
24
+ <View style={tw`flex w-full mt-5`}>
25
+ <View style={tw`flex-row items-center`}>
26
+ <Avatar
27
+ size="sm"
28
+ source={""}
29
+ nameFirstLetter={"J"}
30
+ bg={"sky-400"}
31
+ />
32
+ <View style={tw`ml-3`}>
33
+ <EText size={"xl"} style={tw`font-bold -mt-1`}>{"Anita Kumar"}</EText>
34
+ <EText size="sm" style={[tw`font-normal`, {
35
+ color: Colors["text-body"]
36
+ }]}>
37
+ {"Mentor"}
38
+ </EText>
39
+ </View>
40
+ </View>
41
+ </View>
42
+
43
+ <Spacer height={30} />
44
+ <MenuItems
45
+ title={"Dashboard"}
46
+ icon={<HomeIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />}
47
+ />
48
+ <MenuItems
49
+ title={"School Visit"}
50
+ icon={<CalendarIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />}
51
+ />
52
+ <MenuItems
53
+ title={"Review Meeting"}
54
+ icon={<TemplateIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />}
55
+ />
56
+ <MenuItems
57
+ title={"Mentoring Resources"}
58
+ icon={<ViewBoardsIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />}
59
+ />
60
+ <MenuItems
61
+ title={"Cluster Performance"}
62
+ icon={<TemplateIcon style={[tw`w-6 h-6`, { color: Colors["primary-base"] }]} />}
63
+ />
64
+ <Spacer />
65
+ <Spacer />
66
+ <MenuItems
67
+ title="Profile"
68
+ onPress={() => navigation.navigate("ProfileScreen")}
69
+ />
70
+ <MenuItems
71
+ title="Settings"
72
+ />
73
+ <MenuItems
74
+ title="Logout"
75
+ />
76
+ </View>
77
+ </ScrollView>
78
+ );
79
+ };
80
+
81
+ const styles = StyleSheet.create({
82
+ container: {
83
+ backgroundColor: '#fff',
84
+ padding: 10,
85
+ },
86
+ logoStyle: {
87
+ height: 20,
88
+ width: '80%',
89
+ alignSelf: 'center',
90
+ },
91
+ });
92
+
93
+ export default Drawer;
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import { View } from 'react-native'
3
+ import tw from '../lib/tailwind';
4
+ import EText from './EText';
5
+ import { CheckCircleIcon } from 'react-native-heroicons/solid';
6
+
7
+
8
+ interface IProps {
9
+ text: string;
10
+ completed?: boolean;
11
+ color?: string;
12
+ textColor?: string;
13
+ size: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl" | "title";
14
+ fontWeight: string;
15
+ padding: string;
16
+ }
17
+
18
+ export default function EBadge({ text, completed, color, textColor, size, fontWeight, padding }: IProps) {
19
+ return (
20
+ <View style={[tw` rounded-full flex-row ${padding}`, {backgroundColor: color}]}>
21
+ {completed ? <CheckCircleIcon style={tw`text-white mr-1`} size={16} /> : null}
22
+ <EText size={size} style={tw`${fontWeight} ${textColor ? textColor : ""}`}>
23
+ {text}
24
+ </EText>
25
+ </View>
26
+ )
27
+ }
@@ -0,0 +1,81 @@
1
+ import {
2
+ View,
3
+ Text,
4
+ TouchableOpacity,
5
+ TouchableOpacityProps,
6
+ } from "react-native";
7
+ import React from "react";
8
+ import tw from "../lib/tailwind";
9
+ import EText from "./EText";
10
+ import { Colors } from "../utils/Color";
11
+
12
+ interface EButtonProps extends TouchableOpacityProps {
13
+ iconL?: JSX.Element;
14
+ iconR?: JSX.Element;
15
+ secondary?: boolean;
16
+ inline?: boolean;
17
+ small?: boolean;
18
+ type?: "secondary" | "clear" | "primary";
19
+ }
20
+
21
+ export default function EButton({
22
+ // label,
23
+ children,
24
+ iconL,
25
+ iconR,
26
+ secondary,
27
+ inline,
28
+ small,
29
+ type,
30
+ ...props
31
+ }: EButtonProps) {
32
+ return (
33
+ <TouchableOpacity
34
+ activeOpacity={0.8}
35
+ {...props}
36
+ style={[tw`${inline ? "items-start" : ""}`, {}]}
37
+ >
38
+ <View
39
+ style={[
40
+ tw`h-14 flex-row justify-center items-center px-8 rounded-full ${
41
+ type === "clear"
42
+ ? "bg-transparent"
43
+ : type === "secondary"
44
+ ? `bg-[${Colors["secondary-base"]}] self-start px-5 h-11`
45
+ : `bg-[${Colors["primary-base"]}]`
46
+ }`,
47
+ ]}
48
+ >
49
+ {/* ICON LEFT */}
50
+ {iconL ? <View style={tw`mr-1 -ml-2`}>{iconL}</View> : null}
51
+ {/* LABEL */}
52
+ <EText
53
+ size={small ? "sm" : ""}
54
+ style={[
55
+ tw`font-semibold ${
56
+ type === "clear" ? `text-[${Colors["primary-base"]}]` : "text-white"
57
+ }`,
58
+ ]}
59
+ >
60
+ {children}
61
+ </EText>
62
+
63
+ {/* ICON RIGHT */}
64
+ {iconR ? <View style={tw`ml-1 -mr-2`}>{iconR}</View> : null}
65
+ </View>
66
+ </TouchableOpacity>
67
+ );
68
+ }
69
+
70
+ // style={[
71
+ // tw` ${
72
+ // withoutbackground ? "" : " shadow-md shadow-green-500 rounded-full"
73
+ // } flex items-center justify-center ${
74
+ // small ? "h-12 px-4" : "h-14 px-6 "
75
+ // } ${secondary ? "bg-purple-500 shadow-none" : ""}`,
76
+ // {
77
+ // backgroundColor: withoutbackground
78
+ // ? "transparent"
79
+ // : Colors["primary-base"],
80
+ // },
81
+ // ]}
@@ -0,0 +1,37 @@
1
+ import { View, TouchableOpacity, TouchableOpacityProps } from "react-native";
2
+ import React from "react";
3
+ import tw from "../lib/tailwind";
4
+ import { ArrowNarrowLeftIcon, XIcon } from "react-native-heroicons/solid";
5
+
6
+ interface EButtonIconProps extends TouchableOpacityProps {
7
+ type?: "close";
8
+ backgroundColor?: string;
9
+ iconColor?: string | "slate-900";
10
+ size?: number | 20;
11
+ shadow?: boolean;
12
+ }
13
+
14
+ export default function EButtonIcon({
15
+ type,
16
+ backgroundColor,
17
+ iconColor,
18
+ size,
19
+ shadow,
20
+ ...props
21
+ }: EButtonIconProps) {
22
+ return (
23
+ <TouchableOpacity {...props}>
24
+ <View
25
+ style={tw`h-9 w-9 items-center justify-center bg-${backgroundColor} rounded-full ${
26
+ shadow ? "shadow-xl shadow-slate-400" : ""
27
+ }`}
28
+ >
29
+ {type === "close" ? (
30
+ <XIcon size={20} style={tw`text-${iconColor}`} />
31
+ ) : (
32
+ <ArrowNarrowLeftIcon size={20} style={tw`text-${iconColor}`} />
33
+ )}
34
+ </View>
35
+ </TouchableOpacity>
36
+ );
37
+ }
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { ClockIcon } from "react-native-heroicons/solid";
4
+ import tw from "../lib/tailwind";
5
+ import { Colors } from "../utils/Color";
6
+ import EText from "./EText";
7
+
8
+ export default function EDateAndTimeCard() {
9
+ return (
10
+ <View
11
+ style={[tw`flex-row pb-4 border-b`, { borderBottomColor: Colors.border }]}
12
+ >
13
+ <View
14
+ style={[
15
+ tw`rounded-xl mb-2 px-3 py-1 items-center justify-center`,
16
+ { backgroundColor: Colors["primary-base"] },
17
+ ]}
18
+ >
19
+ <EText size="xl" style={tw`font-bold text-white -mb-1`}>
20
+ {"12"}
21
+ </EText>
22
+ <EText size="xs" style={tw`font-bold text-white`}>
23
+ {"DEC"}
24
+ </EText>
25
+ </View>
26
+ <View style={tw`ml-3`}>
27
+ <EText size="base" style={tw`font-bold text-black opacity-80 -mb-1`}>
28
+ {"Wednesday"}
29
+ </EText>
30
+ <View style={tw`flex-row justify-center items-center mt-2`}>
31
+ <ClockIcon size={16} style={tw`text-slate-400`} />
32
+ <EText
33
+ size="sm"
34
+ style={tw`ml-1 text-slate-400 font-medium`}
35
+ numberOfLines={2}
36
+ >
37
+ {"9:00am - 10:00am"}
38
+ </EText>
39
+ </View>
40
+ </View>
41
+ </View>
42
+ );
43
+ }
@@ -0,0 +1,28 @@
1
+ import { View, Text, Image, ImagePropTypes, ImageProps } from "react-native";
2
+ import React from "react";
3
+ import tw from "../lib/tailwind";
4
+
5
+ interface EIconProps extends ImageProps {
6
+ source: string;
7
+ size?: number | 24;
8
+ tintColor?: string | "slate-900";
9
+ opacity?: number;
10
+ style?: string,
11
+ }
12
+
13
+ export default function EIcon({
14
+ source,
15
+ size,
16
+ tintColor,
17
+ opacity,
18
+ style,
19
+ }: EIconProps) {
20
+ return (
21
+ <View style={[{height: size, width: size}, style]}>
22
+ <Image
23
+ source={source}
24
+ style={[tw`w-full h-full tint-${tintColor} opacity-${opacity}`, {}]}
25
+ />
26
+ </View>
27
+ );
28
+ }
@@ -0,0 +1,41 @@
1
+ import { View, Text } from "react-native";
2
+ import React from "react";
3
+ import tw from "../lib/tailwind";
4
+ import EText from "./EText";
5
+ import { Style } from "twrnc/dist/esm/types";
6
+
7
+ interface InfoBoxProps {
8
+ title?: string;
9
+ icon: JSX.Element;
10
+ children: string;
11
+ color?: string;
12
+ style?: Style;
13
+ childTextColor?: string;
14
+ }
15
+
16
+ export default function InfoBox({
17
+ title,
18
+ icon,
19
+ color,
20
+ children,
21
+ style,
22
+ childTextColor,
23
+ }: InfoBoxProps) {
24
+ return (
25
+ <View style={[tw.style("rounded-lg"), style]}>
26
+ <View style={tw`flex-row`}>
27
+ <View style={tw`w-5 h-5 mr-1`}>{icon}</View>
28
+ <View style={tw`flex-1`}>
29
+ {title ? (
30
+ <EText size="sm" style={tw`font-semibold mb-1 text-${color ? color : "white"}`}>
31
+ {title}
32
+ </EText>
33
+ ) : null}
34
+ <EText size="xs" style={[tw`font-medium`, {color: childTextColor}]}>
35
+ {children}
36
+ </EText>
37
+ </View>
38
+ </View>
39
+ </View>
40
+ );
41
+ }
@@ -0,0 +1,55 @@
1
+ import { View, Text, TextInput, TextInputProps } from "react-native";
2
+ import React, { useState } from "react";
3
+ import tw from "../lib/tailwind";
4
+ import EText from "./EText";
5
+ import { SearchIcon } from "react-native-heroicons/solid";
6
+ import { Colors } from "../utils/Color";
7
+
8
+ interface EInputProps extends TextInputProps {
9
+ label?: string;
10
+ size?: "lg";
11
+ hasBackground?: boolean;
12
+ icon?: JSX.Element;
13
+ }
14
+
15
+ export default function EInput({
16
+ label,
17
+ size,
18
+ style,
19
+ hasBackground,
20
+ icon,
21
+ ...props
22
+ }: EInputProps) {
23
+ const [hasFocus, setHasFocus] = useState(false);
24
+ return (
25
+ <View style={[tw`mb-4`, {}]}>
26
+ {label ? (
27
+ <EText size="xs" style={[tw`font-semibold`, {
28
+ color: Colors["text-primary"]
29
+ }]}>
30
+ {label}
31
+ </EText>
32
+ ) : null}
33
+
34
+ <View
35
+ style={tw`h-12 rounded-lg px-4 flex-row items-center border border-slate-300 lowercase mt-2 ${
36
+ hasFocus ? "border-black" : ""
37
+ }`}
38
+ >
39
+ <TextInput
40
+ style={[tw`text-sm font-normal text-slate-500 h-full w-full `, {
41
+ color: Colors["text-placeholder"]
42
+ }]}
43
+ {...props}
44
+ onFocus={() => setHasFocus(!hasFocus)}
45
+ onBlur={() => setHasFocus(!hasFocus)}
46
+ />
47
+ {
48
+ icon ?
49
+ <>{icon}</>
50
+ : null
51
+ }
52
+ </View>
53
+ </View>
54
+ );
55
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import tw from '../lib/tailwind'
3
+ import EText from './EText';
4
+
5
+ interface IProps{
6
+ label: string;
7
+ }
8
+
9
+ export default function ELabel( {label }: IProps ) {
10
+ return (
11
+ <EText style={tw`text-sm font-semibold text-slate-500`}>
12
+ {label}
13
+ </EText>
14
+ )
15
+ }