You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

week_list.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from 'react';
  2. import { StyleSheet, Text, View, TextInput, Alert, Pressable } from 'react-native';
  3. import DepenseListEntry from '../depense_list_entry';
  4. import { strLPad } from '../../utils/util';
  5. import DayList from './day_list';
  6. export default function WeekList(props)
  7. {
  8. const [ showDays, onToggleDays] = React.useState(true);
  9. let days = []
  10. if(showDays)
  11. props.days.forEach(element => {
  12. days.push(
  13. <DayList
  14. dailyObjective={props.dailyObjective}
  15. fetchDepenses={props.fetchDepenses}
  16. date={element.date}
  17. depenses={element.expenses}
  18. />
  19. )
  20. });
  21. return (
  22. <View style={week_list_styles.week_list_container}>
  23. <Pressable
  24. style={week_list_styles.week_header}
  25. onPress={() => {onToggleDays(!showDays)}}>
  26. <Text>{"Week " + props.number}</Text>
  27. </Pressable>
  28. {days}
  29. </View>
  30. );
  31. }
  32. const week_list_styles = StyleSheet.create({
  33. week_list_container: {
  34. borderWidth: 1,
  35. margin: 1,
  36. },
  37. week_header: {
  38. display: 'flex',
  39. flexDirection: 'row',
  40. justifyContent: 'space-between',
  41. marginTop: 5,
  42. marginBottom: 5,
  43. },
  44. day_list_day: {
  45. fontWeight: '900',
  46. margin: 4,
  47. }
  48. });