Skip to content

Commit

Permalink
fix: components & minor spacing change & input error
Browse files Browse the repository at this point in the history
  • Loading branch information
in-mai-space committed Mar 2, 2024
1 parent a1f016a commit 3607190
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 90 deletions.
10 changes: 6 additions & 4 deletions frontend/sac-mobile/app/(auth)/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ const Login = () => {
<View className="flex-1">
<View className="px-[8%] pb-[10%]">
<View className="pt-[1%]"><Wordmark textColor="white" /></View>

Check failure on line 59 in frontend/sac-mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Replace `<Wordmark·textColor="white"·/>` with `⏎························<Wordmark·textColor="white"·/>⏎····················`
<View className="pt-[10%] pb-[6.5%]">
<View className="pt-[9.5%] pb-[6%]">
<Header

Check warning on line 61 in frontend/sac-mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Empty components are self-closing
text="Let's go"
fontSize="45"
color="white"
></Header>
</View>
<Text className="text-white pt-[3%] text-lg leading-5">
<Text className="text-white pt-[0.9%] text-lg leading-6">
Discover, follow, and join all the clubs & events
Northeastern has to offer
</Text>
</View>
<View className="bg-white pt-[13.5%] pb-[2%] flex-1 rounded-tl-3xl rounded-tr-3xl px-[8%]">
<View className="bg-white pt-[13%] pb-[2%] flex-1 rounded-tl-3xl rounded-tr-3xl px-[8%]">
<View>
<Controller
control={control}
Expand All @@ -81,6 +81,7 @@ const Login = () => {
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.email}
/>
)}
name="email"
Expand All @@ -100,6 +101,7 @@ const Login = () => {
value={value}
secureTextEntry={true}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.password}
/>
)}
name="password"
Expand Down Expand Up @@ -133,7 +135,7 @@ const Login = () => {
</View>
<View className="mt-[9%] flex-row justify-center">
<Text className="font-bold">Not a student?</Text>
<Text> Continue as a guest.</Text>
<Text> Continue as a <Text className="underline">guest</Text></Text>

Check failure on line 138 in frontend/sac-mobile/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Replace `·Continue·as·a·<Text·className="underline">guest</Text>` with `⏎····························{'·'}⏎····························Continue·as·a{'·'}⏎····························<Text·className="underline">guest</Text>⏎························`
</View>
</View>
</View>
Expand Down
60 changes: 39 additions & 21 deletions frontend/sac-mobile/app/(auth)/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { Controller, useForm } from 'react-hook-form';
import {

Check failure on line 3 in frontend/sac-mobile/app/(auth)/register.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Replace `⏎····Alert,⏎····ScrollView,⏎····Text,⏎····View⏎` with `·Alert,·ScrollView,·Text,·View·`
Alert,
ScrollView,
ScrollViewBase,
StyleSheet,
Text,
TextInput,
View
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
Expand Down Expand Up @@ -40,13 +37,15 @@ const graduationYear = () => {
return graduationYear;
}

Check failure on line 38 in frontend/sac-mobile/app/(auth)/register.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Insert `;`

// register form data
type RegisterFormData = {
firstName: string;
lastName: string;
email: string;
id: string;
password: string;
passwordConfirm: string;
id: string;
graduationYear: string;
};

const registerSchema = z.object({
Expand Down Expand Up @@ -99,13 +98,13 @@ const Register = () => {
<View className="pt-[9%] pb-[6%]">
<Header text="Sign up" fontSize="45" color="white"></Header>

Check warning on line 99 in frontend/sac-mobile/app/(auth)/register.tsx

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Empty components are self-closing
</View>
<Text className="text-lg text-white">
<Text className="text-lg leading-6 text-white">
Discover, follow, and join all the clubs & events
Northeastern has to offer
</Text>
</View>
<View className="bg-white px-[8%] pt-[13%] rounded-t-3xl">
<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -116,6 +115,7 @@ const Register = () => {
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.firstName}
/>
)}
name="firstName"
Expand All @@ -126,7 +126,7 @@ const Register = () => {
)}
</View>

<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -137,6 +137,7 @@ const Register = () => {
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.lastName}
/>
)}
name="lastName"
Expand All @@ -145,7 +146,7 @@ const Register = () => {
{errors.lastName && <Text>{errors.lastName.message}</Text>}
</View>

<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -156,6 +157,7 @@ const Register = () => {
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.email}
/>
)}
name="email"
Expand All @@ -164,7 +166,7 @@ const Register = () => {
{errors.email && <Text>{errors.email.message}</Text>}
</View>

<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -175,23 +177,36 @@ const Register = () => {
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
error={!!errors.id}
/>
)}
name="id"
rules={{ required: 'Password is required' }}
rules={{ required: 'NUID is required' }}
/>
{errors.password && <Text>{errors.password.message}</Text>}
{errors.id && <Text>{errors.id.message}</Text>}
</View>

<View className="mb-6">
<DropdownComponent
title="Intended Graduation Year"
item={graduationYear()}
placeholder="Select Year"
<View className="mb-[7%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
<DropdownComponent
title="Intended Graduation Year"
item={graduationYear()}
placeholder="Select Year"
onChangeText={onChange}
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
height="8.5%"
error={!!errors.graduationYear}
/>
)}
name="graduationYear"
rules={{ required: 'Graduation year is required' }}
/>
{errors.graduationYear && <Text className="mt-[-2%]">{errors.graduationYear.message}</Text>}
</View>

<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -203,6 +218,7 @@ const Register = () => {
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
secureTextEntry={true}
error={!!errors.password}
/>
)}
name="password"
Expand All @@ -211,7 +227,7 @@ const Register = () => {
{errors.password && <Text>{errors.password.message}</Text>}
</View>

<View className="w-full mb-7">
<View className="w-full mb-[8.5%]">
<Controller
control={control}
render={({ field: { onChange, value } }) => (
Expand All @@ -223,18 +239,20 @@ const Register = () => {
value={value}
onSubmitEditing={handleSubmit(onSubmit)}
secureTextEntry={true}
error={!!errors.passwordConfirm}
/>
)}
name="passwordConfirm"
rules={{ required: 'Password is required' }}
rules={{ required: 'Please confirm your password' }}
/>
{errors.password && <Text>{errors.password.message}</Text>}
{errors.passwordConfirm && <Text>{errors.passwordConfirm.message}</Text>}
</View>
<View className="pt-[2%] pb-[25%]">
<Button
title="Submit"
fullWidth={true}
color="white"
padding="5%"
onPress={handleSubmit(onSubmit)}
/>
</View>
Expand Down
14 changes: 9 additions & 5 deletions frontend/sac-mobile/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Pressable, StyleSheet, Text, View } from 'react-native';
import { DimensionValue, Pressable, StyleSheet, Text, View } from 'react-native';

type ButtonProps = {
title: string;
backgroundColor?: string;
color?: string;
title: string; // text of the button
backgroundColor?: string; // background color
color?: string; // text color
onPress?: () => void;
borderColor?: string;
fullWidth?: boolean;
padding?: DimensionValue; // padding
};

const Button = (props: ButtonProps) => {
const padding = props.padding + '%'
const styles = StyleSheet.create({
button: {
backgroundColor: props.backgroundColor || 'gray',
Expand All @@ -26,13 +28,15 @@ const Button = (props: ButtonProps) => {
border: {
borderWidth: 1,
borderColor: props.borderColor || 'gray',
paddingTop: props.padding || '9%',
paddingBottom: props.padding || '9%',
}
});

return (
<Pressable onPress={props.onPress} style={styles.button}>
<View
className="border-1 rounded-xl pt-4 pb-4"
className="border-1 rounded-xl"
style={styles.border}
>
<Text className="px-[5%]" style={styles.title}>
Expand Down
Loading

0 comments on commit 3607190

Please sign in to comment.