-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathpost-checkout-registration-fields.jsx
More file actions
43 lines (36 loc) · 1.38 KB
/
post-checkout-registration-fields.jsx
File metadata and controls
43 lines (36 loc) · 1.38 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
40
41
42
43
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import React from 'react'
import PropTypes from 'prop-types'
import {Stack, Box} from '@chakra-ui/react'
import useRegistrationFields from '../../components/forms/useRegistrationFields'
import PasswordRequirements from '../../components/forms/password-requirements'
import Field from '../../components/field'
const PostCheckoutRegistrationFields = ({form, prefix = ''}) => {
const fields = useRegistrationFields({form, prefix})
const password = form.watch(`${prefix}password`)
return (
<Box>
<Stack gap={5}>
<Field {...fields.email} />
<Stack gap={3} paddingBottom={2}>
<Field {...fields.password} />
<PasswordRequirements value={password} />
</Stack>
</Stack>
<Field {...fields.firstName} type="hidden" />
<Field {...fields.lastName} type="hidden" />
</Box>
)
}
PostCheckoutRegistrationFields.propTypes = {
/** Object returned from `useForm` */
form: PropTypes.object.isRequired,
/** Optional prefix for field names */
prefix: PropTypes.string
}
export default PostCheckoutRegistrationFields