-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCreatedByFilter.js
More file actions
36 lines (31 loc) · 1.12 KB
/
CreatedByFilter.js
File metadata and controls
36 lines (31 loc) · 1.12 KB
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
import { SingleSelect, SingleSelectOption } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
// TODO change the "Created by" prefix to "Creator" or something that does not require a context for the translators
export const CREATED_BY_ALL = 'all'
export const CREATED_BY_ALL_BUT_CURRENT_USER = 'allButCurrentUser'
export const CREATED_BY_CURRENT_USER = 'currentUser'
export const CreatedByFilter = ({ selected, onChange }) => (
<SingleSelect
selected={selected}
onChange={({ selected }) => onChange(selected)}
prefix={i18n.t('Created by')}
dense
>
<SingleSelectOption label={i18n.t('Anyone')} value={CREATED_BY_ALL} />
<SingleSelectOption
label={i18n.t('Only you')}
value={CREATED_BY_CURRENT_USER}
/>
<SingleSelectOption
label={i18n.t('Others')}
value={CREATED_BY_ALL_BUT_CURRENT_USER}
/>
</SingleSelect>
)
CreatedByFilter.propTypes = {
onChange: PropTypes.func.isRequired,
selected: PropTypes.string,
}
export default CreatedByFilter