-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathcart-cta.jsx
More file actions
54 lines (51 loc) · 1.93 KB
/
cart-cta.jsx
File metadata and controls
54 lines (51 loc) · 1.93 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
44
45
46
47
48
49
50
51
52
53
54
/*
* 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, {Fragment} from 'react'
import {FormattedMessage} from 'react-intl'
import {Flex, Button} from '@salesforce/retail-react-app/app/components/shared/ui'
import {
AmexIcon,
DiscoverIcon,
LockIcon,
MastercardIcon,
VisaIcon
} from '@salesforce/retail-react-app/app/components/icons'
import Link from '@salesforce/retail-react-app/app/components/link'
import SFPaymentsExpress from '@salesforce/retail-react-app/app/components/sf-payments-express'
import {useShopperConfiguration} from '@salesforce/retail-react-app/app/hooks/use-shopper-configuration'
const CartCta = () => {
const sfPaymentsEnabled = useShopperConfiguration('SalesforcePaymentsAllowed') === true
return (
<Fragment>
<Button
as={Link}
to="/checkout"
width={['95%', '95%', '95%', '100%']}
marginTop={[6, 6, 2, 2]}
mb={sfPaymentsEnabled ? 2 : 4}
rightIcon={<LockIcon />}
variant="solid"
>
<FormattedMessage
defaultMessage="Proceed to Checkout"
id="cart_cta.link.checkout"
/>
</Button>
{sfPaymentsEnabled ? (
<SFPaymentsExpress expressButtonLayout="vertical" maximumButtonCount={4} />
) : (
<Flex justify={'center'}>
<VisaIcon height={8} width={10} mr={2} />
<MastercardIcon height={8} width={10} mr={2} />
<AmexIcon height={8} width={10} mr={2} />
<DiscoverIcon height={8} width={10} mr={2} />
</Flex>
)}
</Fragment>
)
}
export default CartCta