removed folder wrapper from components

This commit is contained in:
thschleicher 2023-12-20 21:15:31 +01:00 committed by Jakob Stornig
parent 645b805aa7
commit 1e48c7b667
5 changed files with 22 additions and 29 deletions

View file

@ -1,7 +1,7 @@
import { View, Text, StyleSheet, Switch, SwitchProps, useColorScheme, TouchableOpacityProps, TouchableOpacity } from 'react-native' import React from 'react';
import React from 'react' import { StyleSheet, Switch, SwitchProps, Text, TouchableOpacity, TouchableOpacityProps, View } from 'react-native';
import { SIZES } from '../../../constants/theme' import { useTheme } from '../../app/contexts/ThemeContext';
import { useTheme } from '../../../app/contexts/ThemeContext'; import { SIZES } from '../../constants/theme';
interface ToggleSettingProps extends SwitchProps { interface ToggleSettingProps extends SwitchProps {
settingsTitle: string; settingsTitle: string;

View file

@ -1,8 +1,8 @@
import React from 'react' import React from 'react'
import { Image, Text, View, ViewProps } from 'react-native' import { Image, Text, View, ViewProps } from 'react-native'
import { TouchableOpacity } from 'react-native-gesture-handler' import { TouchableOpacity } from 'react-native-gesture-handler'
import { MARGINS, SIZES } from '../../../constants/theme' import { MARGINS, SIZES } from '../../constants/theme'
import { useTheme } from '../../../app/contexts/ThemeContext' import { useThemeColor } from '../../hooks/useThemeColor'
type WelcomeProps = ViewProps & {name: string, image : any, onPress: () => void | undefined} type WelcomeProps = ViewProps & {name: string, image : any, onPress: () => void | undefined}
@ -28,13 +28,13 @@ function getTimeOfDay(date: Date) : string {
export default function Welcome(props: WelcomeProps) { export default function Welcome(props: WelcomeProps) {
const {colors} = useTheme()
const date = new Date() const date = new Date()
const dateString = formatDate(date) const dateString = formatDate(date)
const timeOfDay = getTimeOfDay(date) const timeOfDay = getTimeOfDay(date)
const onpress = props.onPress const onpress = props.onPress
const textcolor = colors.primaryText const textcolor = useThemeColor("primaryText")
//const backgroundColor: string = useThemeColor("backgroundColor")
return ( return (
<View style={{ <View style={{

View file

@ -1,18 +1,13 @@
import React from 'react'; import React from 'react';
import { ColorValue, StyleSheet, Text, View } from 'react-native'; import { ColorValue, StyleSheet, Text, View } from 'react-native';
import { SIZES } from '../../../constants/theme'; import { SIZES } from '../../constants/theme';
import { useTheme } from '../../../app/contexts/ThemeContext'; import { useThemeColor } from '../../hooks/useThemeColor';
import CustomCard from "../../common/CustomCard"; import CustomCard from "../common/CustomCard";
import { SimpleDate } from '../../../util/SimpleDate';
type ISOdateString = string export type ExpenseItemProps = {color: ColorValue, category: string, title: string, date: string, value : string}
export type ExpenseItemProps = {color: ColorValue, category: string, title: string, date: ISOdateString, value : string}
export default function ExpenseItem(itemProps : ExpenseItemProps) { export default function ExpenseItem(itemProps : ExpenseItemProps) {
const {colors} = useTheme() const textColor = useThemeColor("primaryText");
const textColor = colors.primaryText const backgroundColor = useThemeColor("backgroundColor")
const backgroundColor = colors.containerColor
const date: SimpleDate = new SimpleDate(new Date(itemProps.date))
return ( return (
<CustomCard> <CustomCard>
<View style={[styles.colorTip, {backgroundColor: itemProps.color}]}></View> <View style={[styles.colorTip, {backgroundColor: itemProps.color}]}></View>
@ -28,7 +23,7 @@ export default function ExpenseItem(itemProps : ExpenseItemProps) {
<Text style={{ <Text style={{
fontSize: SIZES.small, fontSize: SIZES.small,
color: textColor color: textColor
}} numberOfLines={1}>{date.format("DD.MM.YYYY")}</Text> }} numberOfLines={1}>{itemProps.date}</Text>
</View> </View>
<View style={[styles.valueSection, {backgroundColor: backgroundColor}]}> <View style={[styles.valueSection, {backgroundColor: backgroundColor}]}>
<Text style={{ <Text style={{

View file

@ -1,7 +1,7 @@
//home //home
import ExpenseItem from "./home/expenseItem/expenseItem" import { ButtonSetting, ToggleSetting } from "./home/Setting"
import Welcome from "./home/Welcome/Welcome" import Welcome from "./home/Welcome"
import { ToggleSetting, ButtonSetting } from "./home/userSettings/Setting" import ExpenseItem from "./home/expenseItem"
//common //common
import LoadingSymbol from "./common/loadingSymbol" import LoadingSymbol from "./common/loadingSymbol"
@ -14,10 +14,8 @@ import CustomCard from "./common/CustomCard"
import Input from "./login/input" import Input from "./login/input"
export { export {
ExpenseItem, Input, ButtonSetting, CustomCard, ExpenseItem, Input,
LoadingSymbol, Plus, LoadingSymbol, Plus,
SearchBar, Welcome, SearchBar, ToggleSetting, Welcome
ToggleSetting, CustomCard,
ButtonSetting
} }

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import {View, Text, TextInput, StyleSheet} from 'react-native'; import { StyleSheet, Text, TextInput, View } from 'react-native';
import { NativeSyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes';
import { TextInputEndEditingEventData } from 'react-native/Libraries/Components/TextInput/TextInput'; import { TextInputEndEditingEventData } from 'react-native/Libraries/Components/TextInput/TextInput';
import { NativeSyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes';
interface InputProps { interface InputProps {
label? : string, label? : string,