mirror of
https://github.com/lemeow125/Reactnative-notesapp.git
synced 2025-04-20 08:51:24 +08:00
Polished code and removed unused snippets
This commit is contained in:
parent
6bb9897e31
commit
13cadcf726
8 changed files with 86 additions and 113 deletions
|
@ -1,7 +1,7 @@
|
||||||
import * as React from "react";
|
import * as React from 'react';
|
||||||
import { Text, View, Pressable, GestureResponderEvent } from "react-native";
|
import {Text, View, Pressable, GestureResponderEvent} from 'react-native';
|
||||||
import { StyleSheet } from "react-native";
|
import {StyleSheet} from 'react-native';
|
||||||
import styles from "../../../styles";
|
import styles from '../../../styles';
|
||||||
|
|
||||||
export interface props {
|
export interface props {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
@ -12,67 +12,63 @@ export interface props {
|
||||||
|
|
||||||
export default function ButtonAlignLeft(props: props) {
|
export default function ButtonAlignLeft(props: props) {
|
||||||
switch (props.color) {
|
switch (props.color) {
|
||||||
case "Red":
|
case 'Red':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{
|
...{
|
||||||
backgroundColor: "#bc231e",
|
backgroundColor: '#bc231e',
|
||||||
width: props.width,
|
width: props.width,
|
||||||
justifyContent: "flex-start",
|
justifyContent: 'flex-start',
|
||||||
},
|
},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Yellow":
|
case 'Yellow':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{
|
...{
|
||||||
backgroundColor: "#e2b465",
|
backgroundColor: '#e2b465',
|
||||||
width: props.width,
|
width: props.width,
|
||||||
justifyContent: "flex-start",
|
justifyContent: 'flex-start',
|
||||||
},
|
},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Green":
|
case 'Green':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{
|
...{
|
||||||
backgroundColor: "#0dbc6a",
|
backgroundColor: '#0dbc6a',
|
||||||
width: props.width,
|
width: props.width,
|
||||||
justifyContent: "flex-start",
|
justifyContent: 'flex-start',
|
||||||
},
|
},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Blue":
|
case 'Blue':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{
|
...{
|
||||||
backgroundColor: "#005997",
|
backgroundColor: '#005997',
|
||||||
width: props.width,
|
width: props.width,
|
||||||
justifyContent: "flex-start",
|
justifyContent: 'flex-start',
|
||||||
},
|
},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
|
@ -81,10 +77,9 @@ export default function ButtonAlignLeft(props: props) {
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#bc231e" },
|
...{backgroundColor: '#bc231e'},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>
|
||||||
Invalid button color specified
|
Invalid button color specified
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as React from "react";
|
import * as React from 'react';
|
||||||
import { Text, View, Pressable, GestureResponderEvent } from "react-native";
|
import {Text, View, Pressable, GestureResponderEvent} from 'react-native';
|
||||||
import { StyleSheet } from "react-native";
|
import {StyleSheet} from 'react-native';
|
||||||
import styles from "../../../styles";
|
import styles from '../../../styles';
|
||||||
|
|
||||||
export interface props {
|
export interface props {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
@ -12,51 +12,47 @@ export interface props {
|
||||||
|
|
||||||
export default function ButtonCentered(props: props) {
|
export default function ButtonCentered(props: props) {
|
||||||
switch (props.color) {
|
switch (props.color) {
|
||||||
case "Red":
|
case 'Red':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#bc231e", width: props.width },
|
...{backgroundColor: '#bc231e', width: props.width},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Yellow":
|
case 'Yellow':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#e2b465", width: props.width },
|
...{backgroundColor: '#e2b465', width: props.width},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Green":
|
case 'Green':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#0dbc6a", width: props.width },
|
...{backgroundColor: '#0dbc6a', width: props.width},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
case "Blue":
|
case 'Blue':
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#005997", width: props.width },
|
...{backgroundColor: '#005997', width: props.width},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
|
@ -65,10 +61,9 @@ export default function ButtonCentered(props: props) {
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_baseline,
|
...styles.button_generic,
|
||||||
...{ backgroundColor: "#bc231e" },
|
...{backgroundColor: '#bc231e'},
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>
|
||||||
Invalid button color specified
|
Invalid button color specified
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
import * as React from "react";
|
import * as React from 'react';
|
||||||
import { View, Text } from "react-native";
|
import {View, Text} from 'react-native';
|
||||||
import styles from "../../styles";
|
import styles from '../../styles';
|
||||||
import Background from "../../Components/Background/Background";
|
import Background from '../../Components/Background/Background';
|
||||||
|
|
||||||
export interface props {}
|
export default function AddNote() {
|
||||||
|
|
||||||
export default function AddNote(props: props) {
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{ ...styles.text_white, ...{ fontSize: 32 } }}>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>Add Note</Text>
|
||||||
Add Note
|
|
||||||
</Text>
|
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,9 @@ import * as React from 'react';
|
||||||
import {View, Text} from 'react-native';
|
import {View, Text} from 'react-native';
|
||||||
import styles from '../../styles';
|
import styles from '../../styles';
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from '../../Components/Background/Background';
|
||||||
import {useNavigation} from '@react-navigation/native';
|
|
||||||
import {RootDrawerParamList} from '../../Interfaces/Interfaces';
|
|
||||||
import AppIcon from '../../Components/Icons/AppIcon/AppIcon';
|
import AppIcon from '../../Components/Icons/AppIcon/AppIcon';
|
||||||
|
|
||||||
export interface props {}
|
export default function Home() {
|
||||||
|
|
||||||
export default function Home(props: props) {
|
|
||||||
const navigation = useNavigation<RootDrawerParamList>();
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<View
|
<View
|
||||||
|
|
|
@ -3,9 +3,7 @@ import {View, Text} from 'react-native';
|
||||||
import styles from '../../styles';
|
import styles from '../../styles';
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from '../../Components/Background/Background';
|
||||||
|
|
||||||
export interface props {}
|
export default function Login() {
|
||||||
|
|
||||||
export default function Login(props: props) {
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}>Login</Text>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>Login</Text>
|
||||||
|
|
|
@ -3,9 +3,7 @@ import {View, Text} from 'react-native';
|
||||||
import styles from '../../styles';
|
import styles from '../../styles';
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from '../../Components/Background/Background';
|
||||||
|
|
||||||
export interface props {}
|
export default function Register() {
|
||||||
|
|
||||||
export default function Register(props: props) {
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}>Register</Text>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>Register</Text>
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
import * as React from "react";
|
import * as React from 'react';
|
||||||
import { View, Text } from "react-native";
|
import {View, Text} from 'react-native';
|
||||||
import styles from "../../styles";
|
import styles from '../../styles';
|
||||||
import Background from "../../Components/Background/Background";
|
import Background from '../../Components/Background/Background';
|
||||||
|
|
||||||
export interface props {}
|
export default function UserInfo() {
|
||||||
|
|
||||||
export default function UserInfo(props: props) {
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{ ...styles.text_white, ...{ fontSize: 32 } }}>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}>UserInfo</Text>
|
||||||
UserInfo
|
|
||||||
</Text>
|
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
import { StyleSheet } from "react-native";
|
import {StyleSheet} from 'react-native';
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
background: {
|
background: {
|
||||||
backgroundColor: "#002d4c",
|
backgroundColor: '#002d4c',
|
||||||
height: "100%",
|
height: '100%',
|
||||||
width: "100%",
|
width: '100%',
|
||||||
},
|
},
|
||||||
text_white: {
|
text_white: {
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontWeight: "bold",
|
fontWeight: 'bold',
|
||||||
textAlign: "center",
|
textAlign: 'center',
|
||||||
},
|
},
|
||||||
button_baseline: {
|
button_generic: {
|
||||||
justifyContent: "center",
|
justifyContent: 'center',
|
||||||
alignSelf: "center",
|
alignSelf: 'center',
|
||||||
alignItems: "center",
|
alignItems: 'center',
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
flexDirection: "row",
|
flexDirection: 'row',
|
||||||
margin: 8,
|
margin: 8,
|
||||||
padding: 8,
|
padding: 8,
|
||||||
borderRadius: 16,
|
borderRadius: 16,
|
||||||
},
|
},
|
||||||
flex_row: {
|
flex_row: {
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
flexDirection: "row",
|
flexDirection: 'row',
|
||||||
alignItems: "center",
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
flex_column: {
|
flex_column: {
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
flexDirection: "column",
|
flexDirection: 'column',
|
||||||
alignItems: "center",
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue