fix: adjust margins and typography on start page

This commit is contained in:
Christian Landgren 2021-09-04 00:28:49 +02:00
parent 616362d14b
commit aea0b5264b
3 changed files with 63 additions and 32 deletions

View File

@ -147,11 +147,14 @@ export const ChildListItem = ({ child, color }: ChildListItemProps) => {
</Text>
)}
<Text category="c2" style={styles.label}>
{translate('schedule.lunch')}
</Text>
<Text>{menu[moment().isoWeekday() - 1]?.description}</Text>
{!menu[moment().isoWeekday() - 1] ? null : (
<>
<Text category="c2" style={styles.label}>
{translate('schedule.lunch')}
</Text>
<Text>{menu[moment().isoWeekday() - 1]?.description}</Text>
</>
)}
<View style={styles.itemFooterAbsence}>
<Button
accessible
@ -160,6 +163,7 @@ export const ChildListItem = ({ child, color }: ChildListItemProps) => {
appearance="ghost"
accessoryLeft={AlertIcon}
status=""
style={styles.absenceButton}
onPress={() => navigation.navigate('Absence', { child })}
>
{translate('abscense.title')}
@ -212,6 +216,9 @@ const themeStyles = StyleService.create({
...Layout.mainAxis.flexStart,
marginTop: Sizing.t4,
},
absenceButton: {
marginLeft: -20,
},
item: {
marginRight: 12,
paddingHorizontal: 2,

View File

@ -33,27 +33,47 @@ export const DaySummary = ({ child, date = moment() }: DaySummaryProps) => {
const gymBag = lessons.some((lesson) => lesson.code === 'IDH')
return (
<>
<Text category="c2" style={styles.label}>
{translate('schedule.start')} - {translate('schedule.end')}
</Text>
<View style={styles.summary}>
<Text category="s1">
{lessons[0].timeStart.slice(0, 5)}-
{lessons[lessons.length - 1].timeEnd.slice(0, 5)}
{gymBag
? ` (🤼‍♀️ ${translate('schedule.gymBag', {
defaultValue: 'Gympapåse',
})})`
: ''}
</Text>
<View style={styles.summary}>
<View style={styles.part}>
<View>
<Text category="c2" style={styles.label}>
{translate('schedule.start')}
</Text>
<Text category="h5">{lessons[0].timeStart.slice(0, 5)} - </Text>
</View>
</View>
</>
<View style={styles.part}>
<View>
<Text category="c2" style={styles.label}>
{translate('schedule.end')}
</Text>
<Text category="h5">
{lessons[lessons.length - 1].timeEnd.slice(0, 5)}
</Text>
</View>
</View>
<View style={styles.part}>
<View>
<Text category="c2" style={styles.label}>
&nbsp;
</Text>
<Text category="s2">
{gymBag
? ` 🤼‍♀️ ${translate('schedule.gymBag', {
defaultValue: 'Gympapåse',
})}`
: ''}
</Text>
</View>
</View>
</View>
)
}
const themedStyles = StyleService.create({
part: {
flexDirection: 'column',
},
summary: {
flexDirection: 'row',
},

View File

@ -59,16 +59,17 @@ const LessonList = ({ lessons, header, lunch }: LessonListProps) => {
</View>
)}
description={() => (
<Text
style={styles.lessonDescription}
maxFontSizeMultiplier={1}
>{`${timeStart.slice(0, 5)}-${timeEnd.slice(0, 5)} ${
code === 'Lunch'
? lunch?.description
: location
? `(${location})`
: ''
} ${teacher}`}</Text>
<View style={styles.lesson}>
<Text
style={styles.lessonDescription}
maxFontSizeMultiplier={1}
>{`${timeStart.slice(0, 5)}-${timeEnd.slice(0, 5)} (${
location
})`}</Text>
<Text style={styles.lessonDescription} maxFontSizeMultiplier={1}>
{code === 'Lunch' ? lunch?.description : teacher}
</Text>
</View>
)}
/>
)}
@ -166,7 +167,7 @@ const themedStyles = StyleService.create({
padding: 0,
},
item: {
height: 45,
height: 55,
backgroundColor: 'background-basic-color-2',
paddingHorizontal: 0,
borderRadius: 2,
@ -213,4 +214,7 @@ const themedStyles = StyleService.create({
lessonDescription: {
fontSize: 13,
},
lesson: {
flexDirection: 'column',
}
})