forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomainField.js
More file actions
46 lines (40 loc) · 938 Bytes
/
DomainField.js
File metadata and controls
46 lines (40 loc) · 938 Bytes
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
import React from 'react'
import { func, object, oneOfType, shape, string } from 'prop-types'
import { t } from '@lingui/macro'
import { FormField } from './FormField'
function DomainField({
name,
label,
placeholder,
forwardedRef,
inputProps,
...props
}) {
return (
<FormField
name={name}
label={label}
placeholder={placeholder}
ref={forwardedRef}
inputProps={inputProps}
{...props}
/>
)
}
DomainField.propTypes = {
name: string,
label: string,
placeholder: string,
inputProps: object,
forwardedRef: oneOfType([func, shape({ current: object })]),
}
DomainField.defaultProps = {
name: 'domainURL',
label: t`Domain URL:`,
placeholder: t`Domain URL`,
}
const withForwardedRef = React.forwardRef((props, ref) => {
return <DomainField {...props} forwardedRef={ref} />
})
withForwardedRef.displayName = 'DomainField'
export { withForwardedRef as DomainField }