aboutsummaryrefslogtreecommitdiffstats
path: root/components/Note.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'components/Note.jsx')
-rw-r--r--components/Note.jsx38
1 files changed, 38 insertions, 0 deletions
diff --git a/components/Note.jsx b/components/Note.jsx
new file mode 100644
index 0000000..d13e786
--- /dev/null
+++ b/components/Note.jsx
@@ -0,0 +1,38 @@
+import { Pressable, StyleSheet, Text } from 'react-native'
+
+const Note = ({ note, setEdit }) => {
+ const formatDate = d => d.replace('T',' ').replace(/\..*Z/, '')
+
+ return (
+ <Pressable
+ style={styles.note}
+ onPress={() => setEdit(note)}
+ >
+ <Text style={styles.title}>{note.title}</Text>
+ <Text style={styles.dates}>{`Created at: ${formatDate(note.created_at)}`}</Text>
+ <Text style={styles.dates}>{`Updated at: ${formatDate(note.updated_at)}`}</Text>
+ </Pressable>
+ )
+}
+
+const styles = StyleSheet.create({
+ note: {
+ textAlign: 'left',
+ padding: 15,
+ width: '100%',
+ borderColor: '#222',
+ borderStyle: 'solid',
+ borderTopWidth: 1,
+ borderBottomWidth: 1,
+ },
+ title: {
+ color: 'white',
+ fontSize: 18,
+ },
+ dates: {
+ color: '#bbb',
+ fontSize: 10,
+ },
+});
+
+export default Note