File size: 810 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
import { Card } from '@automattic/components';
import { ToggleControl } from '@wordpress/components';
import { useDoNotSellContent } from 'calypso/blocks/do-not-sell-dialog/use-do-not-sell-content';
import SectionHeader from 'calypso/components/section-header';
import { useDoNotSell } from 'calypso/lib/analytics/utils';

export const DoNotSellSetting = () => {
	const { shouldSeeDoNotSell, isDoNotSell, onSetDoNotSell } = useDoNotSell();
	const { title, toggleLabel, longDescription } = useDoNotSellContent();

	if ( ! shouldSeeDoNotSell ) {
		return null;
	}

	return (
		<>
			<SectionHeader label={ title } />
			<Card className="privacy__settings">
				{ longDescription }
				<hr />
				<ToggleControl checked={ isDoNotSell } onChange={ onSetDoNotSell } label={ toggleLabel } />
			</Card>
		</>
	);
};