-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathUpdateButton.js
More file actions
39 lines (36 loc) · 1.18 KB
/
UpdateButton.js
File metadata and controls
39 lines (36 loc) · 1.18 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
37
38
39
import { CircularLoader } from '@dhis2-ui/loader'
import { colors } from '@dhis2/ui-constants'
import { IconSync16 } from '@dhis2/ui-icons'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
import menuButtonStyles from './MenuButton.styles.js'
export const UpdateButton = ({ onClick, disabled, loading, dataTest }) => (
<button onClick={onClick} disabled={disabled} data-test={dataTest}>
{loading ? <CircularLoader extrasmall /> : <IconSync16 />}
{i18n.t('Update')}
<style jsx>{menuButtonStyles}</style>
<style jsx>{`
button {
gap: 8px;
color: ${colors.blue700};
font-weight: 500;
}
button:hover:enabled {
background: ${colors.blue100};
}
button:active {
background: ${colors.blue200};
}
`}</style>
</button>
)
UpdateButton.defaultProps = {
dataTest: 'dhis2-analytics-updatebutton',
}
UpdateButton.propTypes = {
onClick: PropTypes.func.isRequired,
dataTest: PropTypes.string,
disabled: PropTypes.bool,
loading: PropTypes.bool,
}