diff options
author | 2021-08-21 19:54:37 +0200 | |
---|---|---|
committer | 2021-08-21 19:54:37 +0200 | |
commit | 71cc09db93ec9b079a30593e14ca57c98fdc94ac (patch) | |
tree | 652a23dbec9c8395f96b59dc6556363ef556962b /apps/Notes/components/Export.js | |
parent | a9d3686ccc496044cfdee013ccfbece955793052 (diff) | |
download | my_apps-71cc09db93ec9b079a30593e14ca57c98fdc94ac.tar.gz my_apps-71cc09db93ec9b079a30593e14ca57c98fdc94ac.tar.bz2 my_apps-71cc09db93ec9b079a30593e14ca57c98fdc94ac.zip |
color themes
Diffstat (limited to 'apps/Notes/components/Export.js')
-rw-r--r-- | apps/Notes/components/Export.js | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/apps/Notes/components/Export.js b/apps/Notes/components/Export.js index 7232632..e7966e4 100644 --- a/apps/Notes/components/Export.js +++ b/apps/Notes/components/Export.js @@ -6,6 +6,7 @@ import {handleSelect, handleSelectAll, handleExport} from '../helpers/export' const Export = ({setAction}) => { const {notes} = useNotes() const [ids, setIds] = useState(notes.map(n => n.noteId)) + const sortFn = (a, b) => new Date(b.updated_at) - new Date(a.updated_at) if (!notes) return null @@ -23,7 +24,7 @@ const Export = ({setAction}) => { onClick={e => handleExport(e, ids, notes)} /> <p>Notes to export:</p> - <div className={`${styles.export__select}`}> + <div className={styles.export__select}> <input type="checkbox" name='selectAll' @@ -32,20 +33,22 @@ const Export = ({setAction}) => { /> <label htmlFor='selectAll'>Select all</label> </div> - {notes.map(note => ( - <div key={note.noteId}> - <input - type="checkbox" - name={note.noteId} - value={note.noteId} - checked={ids.includes(note.noteId)} - onChange={() => handleSelect(note.noteId, ids, setIds)} - /> - <label htlmfor={note.noteId}> - {note.title} - </label><br/> - </div> - ))} + <ul> + {notes.sort(sortFn).map(note => ( + <li key={note.noteId}> + <input + type="checkbox" + name={note.noteId} + value={note.noteId} + checked={ids.includes(note.noteId)} + onChange={() => handleSelect(note.noteId, ids, setIds)} + /> + <label htlmfor={note.noteId}> + {note.title} + </label><br/> + </li> + ))} + </ul> </div> </section> ) |