diff --git a/packages/app/App.js b/packages/app/App.js index 85b3a84a..a1aeaf47 100644 --- a/packages/app/App.js +++ b/packages/app/App.js @@ -15,8 +15,8 @@ import {AppNavigator} from './components/tabs.component' export default () => ( <> - - + + ) \ No newline at end of file diff --git a/packages/app/components/calendar.component.js b/packages/app/components/calendar.component.js index b77bf354..8f19e8fc 100644 --- a/packages/app/components/calendar.component.js +++ b/packages/app/components/calendar.component.js @@ -1,18 +1,20 @@ import React from 'react'; import { StyleSheet } from 'react-native'; import { Divider, List, ListItem, Icon, Text} from '@ui-kitten/components'; +import moment from 'moment' export const Calendar = ({calendar}) => { - const renderItemIcon = (props) => ( - - ); + const parseMoment = (date) => moment(date, 'YYYY-MM-DD hh:mm') + + const renderItemIcon = (startDate, endDate) => + (props) => const renderItem = ({ item }) => ( ); @@ -20,7 +22,7 @@ export const Calendar = ({calendar}) => { return ( b.startDate < a.startDate)} ItemSeparatorComponent={Divider} renderItem={renderItem} /> @@ -29,7 +31,12 @@ export const Calendar = ({calendar}) => { const styles = StyleSheet.create({ container: { - maxHeight: 200, width: "100%" }, + ongoing: { + color: 'red' + }, + normal: { + color: 'black' + } }); \ No newline at end of file diff --git a/packages/app/components/classmates.component.js b/packages/app/components/classmates.component.js new file mode 100644 index 00000000..ae6fe09e --- /dev/null +++ b/packages/app/components/classmates.component.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { StyleSheet } from 'react-native'; +import { Divider, List, ListItem, Icon, Text, Button} from '@ui-kitten/components'; +import { ContactMenu } from './contactMenu.component'; + +export const Classmates = ({classmates}) => { + + const renderItemIcon = (props) => + + const renderItem = ({ item }) => ( + `${guardian.firstname} ${guardian.lastname}`).join(', ')} + accessoryLeft={renderItemIcon} + accessoryRight={(props) => ContactMenu({...props, contact: item})} + /> + ); + + return ( + + ); +}; + +const styles = StyleSheet.create({ + container: { + width: "100%", + }, +}); \ No newline at end of file diff --git a/packages/app/components/contactMenu.component.js b/packages/app/components/contactMenu.component.js new file mode 100644 index 00000000..3c066501 --- /dev/null +++ b/packages/app/components/contactMenu.component.js @@ -0,0 +1,37 @@ +import React from 'react'; +import { StyleSheet } from 'react-native'; +import { Button, Icon, Layout, MenuItem, OverflowMenu, Text, Divider } from '@ui-kitten/components'; +import {Linking} from 'react-native' + + +export const ContactMenu = ({contact}) => { + + const [visible, setVisible] = React.useState(false); + const [selectedTitle, setSelectedTitle] = React.useState('No items selected'); + + const contactIcon = (props) => + const renderToggleButton = () => ( + + ); + + const CallIcon = (props) => + const SMSIcon = (props) => + const EmailIcon = (props) => + + return ( + setVisible(false)}> + {contact.guardians.map(parent => + <> + + Linking.openURL(`tel:${parent.mobile}`)}/> + Linking.openURL(`sms:${parent.mobile}`)}/> + {parent.email ? Linking.openURL(`mailto:${parent.email}`)}/> : null} + + )} + + ); +}; \ No newline at end of file diff --git a/packages/app/components/newsList.component.js b/packages/app/components/newsList.component.js index 1fc18342..0db4f201 100644 --- a/packages/app/components/newsList.component.js +++ b/packages/app/components/newsList.component.js @@ -44,21 +44,13 @@ export const NewsList = ({news}) => { const styles = StyleSheet.create({ header: { - backgroundColor: '#fff', + backgroundColor: '#eeeeef', minHeight: 30, padding: 25 }, - headerText: { - color: '#000' - }, - container: { - maxHeight: '100%' - }, - contentContainer: { - paddingVertical: 4 - }, item: { - marginVertical: 4 + marginVertical: 10, + marginRight: 10 }, footer: { backgroundColor: '#000' diff --git a/packages/app/components/tabs.component.js b/packages/app/components/tabs.component.js index a8160a93..3a470c93 100644 --- a/packages/app/components/tabs.component.js +++ b/packages/app/components/tabs.component.js @@ -1,36 +1,69 @@ -import React from 'react'; -import { NavigationContainer } from '@react-navigation/native'; -import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; -import { TabBar, Tab, Layout, Text } from '@ui-kitten/components'; -import { ChildList } from './childList.component'; -import { DetailsScreen } from './details.component'; +import React from 'react' +import { StyleSheet } from 'react-native'; +import { TabBar, Tab, TabView, Layout, Text, Icon } from '@ui-kitten/components' +import { NewsList } from './newsList.component' +import { Calendar } from './calendar.component' +import { Classmates } from './classmates.component' +import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'; +import moment from 'moment' -const { Navigator, Screen } = createMaterialTopTabNavigator(); +export const AppNavigator = ({child}) => { + const [selectedIndex, setSelectedIndex] = React.useState(0) -const ChildScreen = ({data}) => ( - - Nyheter - -); + const NewsIcon = (props) => ( + + ) + const CalendarIcon = (props) => ( + + ) -const TopTabBar = ({ navigation, state }) => ( - navigation.navigate(state.routeNames[index])}> - - - -); + const ClassIcon = (props) => ( + + ) -const TabNavigator = ({children}) => ( - }> - - - -); + const SettingsIcon = (props) => ( + + ) + + return ( + + setSelectedIndex(index)}> + + + + + + + + moment(a.startDate).isAfter(moment().startOf('day')) ) }> + + + + + + Klass {child.classmates.length ? child.classmates[0].className : ''} + + + + + + + + Inställningar + + + + + + ) +} -export const AppNavigator = ({children}) => ( - - - -); \ No newline at end of file +const styles = StyleSheet.create({ + tabContainer: { + alignItems: 'flex-start', + justifyContent: 'flex-start', + paddingTop: 5, + paddingLeft: 10, + flexDirection: 'column' + }, +}) \ No newline at end of file