feat: add history screen with measurement list
This commit is contained in:
parent
45b2a2c36e
commit
c51a5f494f
1 changed files with 95 additions and 0 deletions
54
src/components/MeasurementRow.tsx
Normal file
54
src/components/MeasurementRow.tsx
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import React from 'react'
|
||||
import { View, Text, StyleSheet } from 'react-native'
|
||||
import { Measurement } from '../types'
|
||||
|
||||
type Props = { measurement: Measurement }
|
||||
|
||||
export default function MeasurementRow({ measurement }: Props) {
|
||||
return (
|
||||
<View style={styles.row}>
|
||||
<View style={styles.left}>
|
||||
<Text style={styles.date}>
|
||||
{new Date(measurement.measuredAt).toLocaleDateString('nl-NL', {
|
||||
weekday: 'short',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
})}
|
||||
</Text>
|
||||
<Text style={styles.time}>
|
||||
{new Date(measurement.measuredAt).toLocaleTimeString('nl-NL', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.right}>
|
||||
<Text style={styles.weight}>{measurement.weight.toFixed(1)} kg</Text>
|
||||
<Text style={styles.detail}>BMI {measurement.bmi.toFixed(1)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
backgroundColor: '#fff',
|
||||
padding: 16,
|
||||
marginHorizontal: 16,
|
||||
marginVertical: 4,
|
||||
borderRadius: 8,
|
||||
shadowColor: '#000',
|
||||
shadowOpacity: 0.05,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
left: {},
|
||||
date: { fontSize: 14, fontWeight: '600' },
|
||||
time: { fontSize: 12, color: '#666', marginTop: 2 },
|
||||
right: { alignItems: 'flex-end' },
|
||||
weight: { fontSize: 18, fontWeight: '700' },
|
||||
detail: { fontSize: 12, color: '#666' },
|
||||
})
|
||||
Loading…
Reference in a new issue