Skip to content

Commit

Permalink
Add linting, fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hola-soy-milk committed Oct 29, 2023
1 parent 5631b65 commit 7a0162a
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 105 deletions.
36 changes: 19 additions & 17 deletions guest-list-mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { useFonts, Pacifico_400Regular } from '@expo-google-fonts/pacifico';
import { StyleSheet, Text, View } from 'react-native';
import Header from '../components/Header';
import { StatusBar } from 'expo-status-bar';
import { Slot, usePathname } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, View } from 'react-native';

import { Pacifico_400Regular, useFonts } from '@expo-google-fonts/pacifico';

import Header from '../components/Header';
import { colors } from '../styles/constants';

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
paddingBottom: 40,
},
slot: {
flex: 1,
paddingLeft: 30,
paddingRight: 30,
},
});

function routeMapping(pathname: string) {
switch (pathname) {
case '/':
Expand Down Expand Up @@ -38,16 +53,3 @@ export default function HomeLayout() {
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
paddingBottom: 40,
},
slot: {
flex: 1,
paddingLeft: 30,
paddingRight: 30,
},
});
42 changes: 22 additions & 20 deletions guest-list-mobile/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
import { FlatList, StyleSheet, Text, View } from 'react-native';
import GuestItem from '../components/GuestItem';
import { useEffect, useState } from 'react';

import { Link, useLocalSearchParams } from 'expo-router';
import { FlatList, StyleSheet } from 'react-native';

import GuestItem from '../components/GuestItem';
import { colors } from '../styles/constants';

const styles = StyleSheet.create({
list: {
marginTop: 30,
paddingLeft: 30,
paddingRight: 30,
width: '100%',
},
button: {
marginTop: 30,
paddingTop: 10,
paddingBottom: 10,
width: '100%',
textAlign: 'center',
backgroundColor: colors.cardBackground,
fontSize: 24,
},
});

type Guest = {
id: string;
firstName: string;
Expand Down Expand Up @@ -61,21 +81,3 @@ export default function Index() {
</>
);
}

const styles = StyleSheet.create({
list: {
marginTop: 30,
paddingLeft: 30,
paddingRight: 30,
width: '100%',
},
button: {
marginTop: 30,
paddingTop: 10,
paddingBottom: 10,
width: '100%',
textAlign: 'center',
backgroundColor: colors.cardBackground,
fontSize: 24,
},
});
54 changes: 28 additions & 26 deletions guest-list-mobile/app/new-guest.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
import { useState } from 'react';
import { StyleSheet, Text, TextInput } from 'react-native';
import { colors } from '../styles/constants';

import { Link } from 'expo-router';
import { StyleSheet, TextInput } from 'react-native';

import { colors } from '../styles/constants';

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
alignItems: 'center',
justifyContent: 'center',
},
input: {
marginTop: 30,
paddingLeft: 30,
paddingRight: 30,
width: '100%',
},
button: {
marginTop: 30,
paddingTop: 10,
paddingBottom: 10,
width: '100%',
textAlign: 'center',
backgroundColor: colors.cardBackground,
fontSize: 24,
},
});

export default function NewGuest() {
const [firstName, setFirstName] = useState('');
Expand Down Expand Up @@ -29,27 +55,3 @@ export default function NewGuest() {
</>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
alignItems: 'center',
justifyContent: 'center',
},
input: {
marginTop: 30,
paddingLeft: 30,
paddingRight: 30,
width: '100%',
},
button: {
marginTop: 30,
paddingTop: 10,
paddingBottom: 10,
width: '100%',
textAlign: 'center',
backgroundColor: colors.cardBackground,
fontSize: 24,
},
});
55 changes: 28 additions & 27 deletions guest-list-mobile/components/GuestItem.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import { StyleSheet, Text, View } from 'react-native';
import { colors } from '../styles/constants';
import { Link } from 'expo-router';
import { StyleSheet, Text, View } from 'react-native';

type Guest = {
id: string;
firstName: string;
lastName: string;
deadline?: string;
attending: boolean;
};

type Props = {
guest: Guest;
};

export default function GuestItem({ guest }: Props) {
const { firstName, lastName, attending } = guest;

return (
<View style={styles.card}>
<Text style={styles.center}>
{firstName} {lastName}
</Text>
<Link href={`guests/${guest.id}`}>Check it out</Link>
<Text style={styles.right}>{attending ? 'Coming!' : 'Not Coming'}</Text>
</View>
);
}
import { colors } from '../styles/constants';

const styles = StyleSheet.create({
right: {
Expand Down Expand Up @@ -57,3 +32,29 @@ const styles = StyleSheet.create({
textAlign: 'left',
},
});

type Guest = {
id: string;
firstName: string;
lastName: string;
deadline?: string;
attending: boolean;
};

type Props = {
guest: Guest;
};

export default function GuestItem({ guest }: Props) {
const { firstName, lastName, attending } = guest;

return (
<View style={styles.card}>
<Text style={styles.center}>
{firstName} {lastName}
</Text>
<Link href={`guests/${guest.id}`}>Check it out</Link>
<Text style={styles.right}>{attending ? 'Coming!' : 'Not Coming'}</Text>
</View>
);
}
29 changes: 15 additions & 14 deletions guest-list-mobile/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import { SafeAreaView, View, Text, StyleSheet } from 'react-native';
import { colors } from '../styles/constants';
import Constants from 'expo-constants';
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';

type Props = {
label: string;
};
export default function Header(props: Props) {
return (
<SafeAreaView style={styles.safeArea}>
<View style={styles.container}>
<Text style={styles.label}>{props.label}</Text>
</View>
</SafeAreaView>
);
}
import { colors } from '../styles/constants';

const styles = StyleSheet.create({
safeArea: {
Expand All @@ -31,3 +19,16 @@ const styles = StyleSheet.create({
fontFamily: 'Pacifico_400Regular',
},
});

type Props = {
label: string;
};
export default function Header(props: Props) {
return (
<SafeAreaView style={styles.safeArea}>
<View style={styles.container}>
<Text style={styles.label}>{props.label}</Text>
</View>
</SafeAreaView>
);
}
3 changes: 2 additions & 1 deletion guest-list-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
"web": "expo start --web",
"lint": "eslint --ext .js --ignore-path .gitignore ."
},
"dependencies": {
"@expo-google-fonts/pacifico": "^0.2.3",
Expand Down

0 comments on commit 7a0162a

Please sign in to comment.