File size: 754 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { ToggleControl } from '@wordpress/components';
import clsx from 'clsx';
import { useTranslate } from 'i18n-calypso';

type EmailMeNewCommentsToggleProps = {
	className?: string;
	value: boolean;
	isDisabled: boolean;
	onChange: ( value: boolean ) => void;
};

const EmailMeNewCommentsToggle = ( {
	className = '',
	value = false,
	isDisabled = false,
	onChange,
}: EmailMeNewCommentsToggleProps ) => {
	const translate = useTranslate();

	return (
		<div className={ clsx( 'email-me-new-comments-toggle', className ) }>
			<ToggleControl
				label={ translate( 'Email me new comments' ) }
				onChange={ () => onChange( ! value ) }
				checked={ value }
				disabled={ isDisabled }
			/>
		</div>
	);
};

export default EmailMeNewCommentsToggle;