-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from aaronleopold/126-refactor-ui-into-reusab…
…le-components 126 refactor UI into reusable components
- Loading branch information
Showing
15 changed files
with
4,772 additions
and
1,859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { queryClient, useUserStore } from '@stump/client' | ||
import { useRootNavigationState, useRouter } from 'expo-router' | ||
import { useEffect } from 'react' | ||
|
||
/// This is the root component of the app. | ||
/// It is responsible for redirecting the user to the correct page. | ||
/// It is also responsible for invalidating the cache when the user logs in or out. | ||
export default function App() { | ||
const navigationState = useRootNavigationState() | ||
const router = useRouter() | ||
|
||
const { user } = useUserStore((store) => ({ | ||
user: store.user, | ||
})) | ||
|
||
useEffect(() => { | ||
// Temporary fix for the router not being ready. | ||
if (!navigationState?.key) return | ||
|
||
if (user) { | ||
queryClient.invalidateQueries(['getLibraries']) | ||
router.push('/home') | ||
return | ||
} | ||
|
||
router.push('/connect') | ||
}, [navigationState?.key, user]) | ||
|
||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Text, TouchableOpacity } from 'nativewind/dist/preflight' | ||
|
||
type ButtonProps = { | ||
label: string | ||
onTap: () => void | ||
} | ||
|
||
export const PrimaryButton = (props: ButtonProps) => { | ||
return ( | ||
<TouchableOpacity | ||
className="mx-auto mt-10 rounded-lg bg-gray-900 p-3 px-6" | ||
onPress={props.onTap} | ||
> | ||
<Text className="text-white">{props.label}</Text> | ||
</TouchableOpacity> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Text } from 'react-native' | ||
|
||
export const TitleText = ({ text }: { text: string }) => ( | ||
<Text className="text-2xl font-semibold">{text}</Text> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import { Text, TextInput, View } from 'react-native' | ||
|
||
type TextFieldProps = { | ||
className?: string | ||
label?: string | ||
placeholder?: string | ||
value?: string | ||
onChange: (value: string) => void | ||
secureTextEntry?: boolean | ||
} | ||
|
||
const TextField = ({ | ||
className, | ||
label, | ||
value, | ||
placeholder, | ||
onChange, | ||
secureTextEntry, | ||
}: TextFieldProps) => { | ||
return ( | ||
<View className={className}> | ||
{label && <Text className="mb-2 font-medium">{label}</Text>} | ||
<TextInput | ||
className="w-full rounded-md border border-black px-5 py-3" | ||
placeholder={placeholder} | ||
value={value} | ||
placeholderTextColor={'#999'} | ||
onChangeText={onChange} | ||
secureTextEntry={secureTextEntry} | ||
/> | ||
</View> | ||
) | ||
} | ||
|
||
export default TextField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./app/**/*.{js,jsx,ts,tsx}', './components/**/*.{js,jsx,ts,tsx}'], | ||
plugins: [], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.