From d77d7c440333ded46eeb8d28e22ec5517f3b15b8 Mon Sep 17 00:00:00 2001
From: piotrruss <mail@pruss.it>
Date: Wed, 18 May 2022 23:02:58 +0100
Subject: small fixes

---
 components/Note.jsx | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 components/Note.jsx

(limited to 'components/Note.jsx')

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
-- 
cgit v1.2.3

