import { View, Text, Pressable, db } from '@glyx-dev/react'
import { useState } from 'react'
export default function App() {
const notes = db.query(
'SELECT * FROM notes ORDER BY updated_at DESC'
)
const [active, setActive] = useState(notes[0]?.id)
return (
<View style={{ flex: 1, flexDirection: 'row' }}>
<View style={{ width: 240, borderRight: '1px solid #2A2A3A' }}>
{notes.map(note => (
<Pressable key={note.id} onPress={() => setActive(note.id)}>
<Text style={{ padding: 16 }}>{note.title}</Text>
</Pressable>
))}
</View>
<NoteEditor id={active} />
</View>
)
}