All files / app/customer SubscribeField.tsx

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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  8x   8x 8x           111x                                     8x  
import { FieldProps } from 'formik';
import React, { memo, Fragment, FunctionComponent } from 'react';
 
import { TranslatedString } from '../locale';
import { Input, Label } from '../ui/form';
 
export type SubscribeFieldProps = FieldProps<boolean> & {
    requiresMarketingConsent: boolean;
};
 
const SubscribeField: FunctionComponent<SubscribeFieldProps> = ({ field, requiresMarketingConsent }) => (
    <Fragment>
        <Input
            { ...field }
            checked={ field.value }
            className="form-checkbox"
            id={ field.name }
            type="checkbox"
        />
 
        <Label htmlFor={ field.name }>
            <TranslatedString id={ requiresMarketingConsent ?
                'customer.guest_marketing_consent' :
                'customer.guest_subscribe_to_newsletter_text' }
            />
        </Label>
    </Fragment>
);
 
export default memo(SubscribeField);