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