forked from Automattic/wp-calypso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reading Settings: Add new 'For each new post email, include..' newsle…
…tter setting (Automattic#71247) * Reading Settings: Add new 'For each new post email, include..' newsletter setting * Update client/my-sites/site-settings/settings-reading/main.tsx Co-authored-by: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> * Update client/my-sites/site-settings/reading-newsletter-settings/ExcerptSetting.tsx Co-authored-by: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> * Add localizeUrl import to ExcerptSetting component Co-authored-by: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com>
- Loading branch information
1 parent
248e4c4
commit 24544fc
Showing
3 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
client/my-sites/site-settings/reading-newsletter-settings/ExcerptSetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { localizeUrl } from '@automattic/i18n-utils'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import FormFieldset from 'calypso/components/forms/form-fieldset'; | ||
import FormLabel from 'calypso/components/forms/form-label'; | ||
import FormRadio from 'calypso/components/forms/form-radio'; | ||
import FormSettingExplanation from 'calypso/components/forms/form-setting-explanation'; | ||
|
||
type ExcerptSettingProps = { | ||
value?: boolean; | ||
disabled?: boolean; | ||
updateFields?: ( fields: { [ key: string ]: unknown } ) => void; | ||
}; | ||
|
||
export const ExcerptSetting = ( { | ||
value = false, | ||
disabled, | ||
updateFields, | ||
}: ExcerptSettingProps ) => { | ||
const translate = useTranslate(); | ||
return ( | ||
<FormFieldset> | ||
<FormLabel>For each new post email, include</FormLabel> | ||
<FormLabel> | ||
{ /* @ts-expect-error FormRadio is not typed and is causing errors */ } | ||
<FormRadio | ||
checked={ ! value } | ||
onChange={ () => updateFields?.( { wpcom_subscription_emails_use_excerpt: false } ) } | ||
disabled={ disabled } | ||
label={ translate( 'Full text' ) } | ||
/> | ||
</FormLabel> | ||
<FormLabel> | ||
{ /* @ts-expect-error FormRadio is not typed and is causing errors */ } | ||
<FormRadio | ||
checked={ value } | ||
onChange={ () => updateFields?.( { wpcom_subscription_emails_use_excerpt: true } ) } | ||
disabled={ disabled } | ||
label={ translate( 'Excerpt' ) } | ||
/> | ||
</FormLabel> | ||
<FormSettingExplanation> | ||
{ translate( | ||
'Sets whether email subscribers can read full posts in emails or just an excerpt and link to the full version of the post. {{link}}Learn more about sending emails{{/link}}.', | ||
{ | ||
components: { | ||
link: ( | ||
<a | ||
href={ localizeUrl( 'https://wordpress.com/support/launch-a-newsletter/' ) } | ||
target="_blank" | ||
rel="noreferrer" | ||
/> | ||
), | ||
}, | ||
} | ||
) } | ||
</FormSettingExplanation> | ||
</FormFieldset> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters