aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Notes/components/Actions.js
blob: 1f5d680a18e2f8a819c8575dce6af98862f62eff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import NoteView from './NoteView'
import NoteEdit from './NoteEdit'
import Import from './Import'
import Export from './Export'

const Actions = ({
  action, setAction, fetchedNote, setFetchedNote
}) => {
  switch (action) {
    case 'showNote': return (
      <NoteView
        fetchedNote={fetchedNote}
        setFetchedNote={setFetchedNote}
        setAction={setAction}
      />
    )
    case 'addNote': return (
      <NoteEdit
        action={action}
        setAction={setAction}
      />
    )
    case 'editNote': return (
      <NoteEdit
        action={action}
        setAction={setAction}
        fetchedNote={fetchedNote}
      />
    )
    case 'importNotes': return (
      <Import
        setAction={setAction}
      />
    )
    case 'exportNotes': return (
      <Export
        setAction={setAction}
      />
    )
    default: {
      setAction('')
      return null
    }
  }
}

export default Actions