Skip to content

Commit 6f9742f

Browse files
committed
Refactor Input component styles and enhance Signup form placeholders
1 parent c343d95 commit 6f9742f

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

src/components/Input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Colors } from '@utils/colors'
2-
import { SEMIBOLD } from '@utils/fonts'
2+
import { F, SEMIBOLD } from '@utils/fonts'
33
import { cn } from '@utils/utils'
44
import React from 'react'
55
import { TextInput, View, useColorScheme, type TextInputProps } from 'react-native'
@@ -17,7 +17,7 @@ export function Input({ Icon, Right, accent = Colors.accent, multiline, classNam
1717
{Icon}
1818
<TextInput
1919
className={cn('flex-1 px-0 py-3 text-zinc-800 dark:text-zinc-200', className)}
20-
style={[{ fontSize: 12.5, marginBottom: 1, paddingVertical: 0, flex: 1 }, SEMIBOLD]}
20+
style={[{ marginBottom: 1, paddingVertical: 0, flex: 1 }, F.F12_5, SEMIBOLD]}
2121
placeholderTextColor={scheme === 'dark' ? Colors.zinc[500] : Colors.zinc[400]}
2222
cursorColor={accent}
2323
selectionColor={accent + '77'}

src/components/RoundNotification.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { SemiBold } from '@utils/fonts'
2-
import React from 'react'
32
import { View } from 'react-native'
43

54
export default function RoundNotification({ n }: { n: number }) {
65
if (n === 0) return null
76
return (
87
<View className='items-center justify-center rounded-full bg-red-500' style={{ height: 22, width: 22 }}>
9-
<SemiBold className='text-xs text-white' style={{ paddingTop: 2 }} numberOfLines={1}>
8+
<SemiBold className='text-xs text-white' style={{ paddingBottom: 2 }} numberOfLines={1}>
109
{n}
1110
</SemiBold>
1211
</View>

src/screens/Settings/UiAndComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default function UiAndComponents({ navigation }: NavProp) {
115115
<SettGroup title='Text area'>
116116
<Input
117117
placeholder='This is a input field with multiple lines. You can type as much as you want.'
118-
numberOfLines={5}
118+
numberOfLines={8}
119119
multiline
120120
/>
121121
</SettGroup>

src/screens/auth/Login.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default function Login({ navigation }: NavProp) {
8989
<SettGroup title='Email or Username'>
9090
<Input
9191
Icon={<RoundedIcon Icon={Mail02SolidIcon} className='bg-rose-500' />}
92+
autoComplete='email'
9293
placeholder='Email or Username'
9394
value={username}
9495
onChangeText={setUsername}
@@ -101,6 +102,7 @@ export default function Login({ navigation }: NavProp) {
101102
<SettGroup title='Password'>
102103
<Input
103104
value={password}
105+
autoComplete='password'
104106
onChangeText={setPassword}
105107
placeholder='Password'
106108
secureTextEntry={!isVisible}

src/screens/auth/Signup.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export default function Signup({ navigation }: NavProp) {
8080
})
8181

8282
useEffect(() => {
83+
if(!username) return setStatus(NameStatus.Initial)
8384
setStatus(NameStatus.Checking)
8485
const timer = setTimeout(() => {
8586
const { error, data } = usernameStatusZodValidator.safeParse({ username })
@@ -93,7 +94,7 @@ export default function Signup({ navigation }: NavProp) {
9394
return () => clearTimeout(timer)
9495
}, [checkUsername, username])
9596

96-
function handelSubmit() {
97+
function handleSubmit() {
9798
const { error, data } = signupZodValidator.safeParse({ username, password, email, name })
9899
console.log(error)
99100
if (error) {
@@ -114,15 +115,17 @@ export default function Signup({ navigation }: NavProp) {
114115
<SettGroup title='Full Name'>
115116
<Input
116117
Icon={<RoundedIcon Icon={TextFontSolidIcon} className='bg-blue-500' />}
117-
placeholder='Full Name'
118+
placeholder='Your Full Name'
119+
autoComplete='name'
118120
value={name}
119121
onChangeText={setName}
120122
/>
121123
</SettGroup>
122124
<SettGroup title='Email'>
123125
<Input
124126
Icon={<RoundedIcon Icon={Mail02SolidIcon} className='bg-rose-500' />}
125-
placeholder='Email'
127+
placeholder='Your Email'
128+
autoComplete='email'
126129
value={email}
127130
keyboardType='email-address'
128131
onChangeText={setEmail}
@@ -131,7 +134,8 @@ export default function Signup({ navigation }: NavProp) {
131134
<SettGroup title='Username'>
132135
<Input
133136
Icon={<RoundedIcon Icon={StarSolidIcon} className='bg-amber-500' />}
134-
placeholder='Username'
137+
placeholder='Select a Username'
138+
autoComplete='username'
135139
value={username}
136140
onChangeText={setUsername}
137141
Right={<UsernameStatus isAvail={status} />}
@@ -142,7 +146,8 @@ export default function Signup({ navigation }: NavProp) {
142146
<Input
143147
value={password}
144148
onChangeText={setPassword}
145-
placeholder='Password'
149+
placeholder='Enter Password'
150+
autoComplete='password'
146151
secureTextEntry={!isVisible}
147152
Icon={<RoundedIcon Icon={LockPasswordSolidIcon} className='bg-slate-500' />}
148153
Right={<PasswordEye isVisible={isVisible} setIsVisible={setIsVisible} />}
@@ -158,7 +163,7 @@ export default function Signup({ navigation }: NavProp) {
158163
title={isPending ? 'Signing up...' : 'Signup'}
159164
className='w-full'
160165
disabled={isPending}
161-
onPress={handelSubmit}
166+
onPress={handleSubmit}
162167
/>
163168
</View>
164169
<SettGroup title='More Options' className='mt-5'>
@@ -189,8 +194,8 @@ function UsernameStatus({ isAvail }: { isAvail: NameStatus }) {
189194
return (
190195
<>
191196
{isAvail === NameStatus.Checking && <ActivityIndicator size={23} color={Colors.accent} />}
192-
{isAvail === NameStatus.Available && <Tick01Icon className='text-green-500' height={22} width={22} />}
193-
{isAvail === NameStatus.Unavailable && <Cancel01SolidIcon className='text-red-500' width={20} height={20} />}
197+
{isAvail === NameStatus.Available && <Tick01Icon height={22} width={22} color={Colors.green[500]} />}
198+
{isAvail === NameStatus.Unavailable && <Cancel01SolidIcon width={20} height={20} color={Colors.red[500]} />}
194199
</>
195200
)
196201
}

src/utils/fonts.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const F = StyleSheet.create({
8282
},
8383
F12_5: {
8484
fontSize: 12.5,
85+
lineHeight: 18,
8586
},
8687
F13: {
8788
fontSize: 13,

0 commit comments

Comments
 (0)