react-code-dataset / wp-calypso /client /landing /subscriptions /components /settings /site-settings /email-me-new-posts-toggle.tsx
react-code-dataset / wp-calypso /client /landing /subscriptions /components /settings /site-settings /email-me-new-posts-toggle.tsx
Download wp-calypso/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 886 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx
-
curl -L -o email-me-new-posts-toggle.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/landing/subscriptions/components/settings/site-settings/email-me-new-posts-toggle.tsx
886 Bytes
| import { ToggleControl } from '@wordpress/components'; | |
| import clsx from 'clsx'; | |
| import { useTranslate } from 'i18n-calypso'; | |
| type EmailMeNewPostsToggleProps = { | |
| className?: string; | |
| isDisabled?: boolean; | |
| hintText?: boolean; | |
| value: boolean; | |
| onChange: ( value: boolean ) => void; | |
| }; | |
| const EmailMeNewPostsToggle = ( { | |
| className = '', | |
| isDisabled = false, | |
| hintText = false, | |
| value = false, | |
| onChange, | |
| }: EmailMeNewPostsToggleProps ) => { | |
| const translate = useTranslate(); | |
| return ( | |
| <div className={ clsx( 'email-me-new-posts-toggle', className, { 'is-enabled': value } ) }> | |
| <ToggleControl | |
| label={ translate( 'Email me new posts' ) } | |
| onChange={ () => onChange( ! value ) } | |
| checked={ value } | |
| disabled={ isDisabled } | |
| /> | |
| { hintText && <div className="email-new-posts-toggle__hint">{ hintText }</div> } | |
| </div> | |
| ); | |
| }; | |
| export default EmailMeNewPostsToggle; | |