-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3430 from Automattic/feat/ia-settings-display-set…
…tings__part-2 feat(ia): display settings - part 2
- Loading branch information
Showing
9 changed files
with
475 additions
and
31 deletions.
There are no files selected for viewing
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
156 changes: 156 additions & 0 deletions
156
src/wizards/newspack/views/settings/display-settings/featured-image-posts-all.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,156 @@ | ||
/** | ||
* Newspack > Settings > Display Settings > Featured Image Posts All | ||
*/ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Fragment } from '@wordpress/element'; | ||
import { Notice } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Grid, SelectControl } from '../../../../../components/src'; | ||
|
||
export default function FeaturedImagePostsAll( { | ||
data, | ||
update, | ||
postCount, | ||
}: ThemeModComponentProps< DisplaySettings > & { postCount: string } ) { | ||
return ( | ||
<Fragment> | ||
{ Number( postCount ) > 1000 && ( | ||
<Notice | ||
isDismissible={ false } | ||
status="warning" | ||
className="ma0 mb2" | ||
> | ||
{ __( | ||
'You have more than 1000 posts. Applying these settings might take a moment.', | ||
'newspack-plugin' | ||
) } | ||
</Notice> | ||
) } | ||
<Grid gutter={ 32 }> | ||
<div> | ||
<SelectControl | ||
label={ __( | ||
'Featured image position for all posts', | ||
'newspack-plugin' | ||
) } | ||
help={ __( | ||
'Set a featured image position for all posts.', | ||
'newspack-plugin' | ||
) } | ||
value={ data.featured_image_all_posts } | ||
options={ [ | ||
{ | ||
label: __( | ||
'Select to change all posts', | ||
'newspack-plugin' | ||
), | ||
value: 'none', | ||
}, | ||
{ | ||
label: __( 'Large', 'newspack-plugin' ), | ||
value: 'large', | ||
}, | ||
{ | ||
label: __( 'Small', 'newspack-plugin' ), | ||
value: 'small', | ||
}, | ||
{ | ||
label: __( | ||
'Behind article title', | ||
'newspack-plugin' | ||
), | ||
value: 'behind', | ||
}, | ||
{ | ||
label: __( | ||
'Beside article title', | ||
'newspack-plugin' | ||
), | ||
value: 'beside', | ||
}, | ||
{ | ||
label: __( 'Hidden', 'newspack-plugin' ), | ||
value: 'hidden', | ||
}, | ||
] } | ||
onChange={ ( featured_image_all_posts: string ) => | ||
update( { featured_image_all_posts } ) | ||
} | ||
/> | ||
{ data.featured_image_all_posts !== 'none' && ( | ||
<Notice | ||
isDismissible={ false } | ||
status="warning" | ||
className="ma0 mt2" | ||
> | ||
{ __( | ||
'After saving the settings with this option selected, all posts will be updated. This cannot be undone.', | ||
'newspack-plugin' | ||
) } | ||
</Notice> | ||
) } | ||
</div> | ||
|
||
<div> | ||
<SelectControl | ||
label={ __( | ||
'Template for all posts', | ||
'newspack-plugin' | ||
) } | ||
help={ __( | ||
'Set a template for all posts.', | ||
'newspack-plugin' | ||
) } | ||
value={ data.post_template_all_posts } | ||
options={ [ | ||
{ | ||
label: __( | ||
'Select to change all posts', | ||
'newspack-plugin' | ||
), | ||
value: 'none', | ||
}, | ||
{ | ||
label: __( 'With sidebar', 'newspack-plugin' ), | ||
value: 'default', | ||
}, | ||
{ | ||
label: __( 'One Column', 'newspack-plugin' ), | ||
value: 'single-feature.php', | ||
}, | ||
{ | ||
label: __( | ||
'One Column Wide', | ||
'newspack-plugin' | ||
), | ||
value: 'single-wide.php', | ||
}, | ||
] } | ||
onChange={ ( post_template_all_posts: string ) => | ||
update( { post_template_all_posts } ) | ||
} | ||
/> | ||
{ data.post_template_all_posts !== 'none' && ( | ||
<Notice | ||
isDismissible={ false } | ||
status="warning" | ||
className="ma0 mt2" | ||
> | ||
{ __( | ||
'After saving the settings with this option selected, all posts will be updated. This cannot be undone.', | ||
'newspack-plugin' | ||
) } | ||
</Notice> | ||
) } | ||
</div> | ||
</Grid> | ||
</Fragment> | ||
); | ||
} |
81 changes: 81 additions & 0 deletions
81
src/wizards/newspack/views/settings/display-settings/featured-image-posts-new.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,81 @@ | ||
/** | ||
* Newspack > Settings > Display Settings > Featured Image Posts New | ||
*/ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Grid, SelectControl } from '../../../../../components/src'; | ||
|
||
export default function FeaturedImagePostsNew( { | ||
data, | ||
update, | ||
}: ThemeModComponentProps< DisplaySettings > ) { | ||
return ( | ||
<Grid gutter={ 32 }> | ||
<SelectControl | ||
label={ __( | ||
'Default featured image position for new posts', | ||
'newspack-plugin' | ||
) } | ||
help={ __( | ||
'Set a default featured image position for new posts.', | ||
'newspack-plugin' | ||
) } | ||
value={ data.featured_image_default } | ||
options={ [ | ||
{ label: __( 'Large', 'newspack-plugin' ), value: 'large' }, | ||
{ label: __( 'Small', 'newspack-plugin' ), value: 'small' }, | ||
{ | ||
label: __( 'Behind article title', 'newspack-plugin' ), | ||
value: 'behind', | ||
}, | ||
{ | ||
label: __( 'Beside article title', 'newspack-plugin' ), | ||
value: 'beside', | ||
}, | ||
{ | ||
label: __( 'Hidden', 'newspack-plugin' ), | ||
value: 'hidden', | ||
}, | ||
] } | ||
onChange={ ( featured_image_default: string ) => | ||
update( { featured_image_default } ) | ||
} | ||
/> | ||
<SelectControl | ||
label={ __( | ||
'Default template for new posts', | ||
'newspack-plugin' | ||
) } | ||
help={ __( | ||
'Set a default template for new posts.', | ||
'newspack-plugin' | ||
) } | ||
value={ data.post_template_default } | ||
options={ [ | ||
{ | ||
label: __( 'With sidebar', 'newspack-plugin' ), | ||
value: 'default', | ||
}, | ||
{ | ||
label: __( 'One Column', 'newspack-plugin' ), | ||
value: 'single-feature.php', | ||
}, | ||
{ | ||
label: __( 'One Column Wide', 'newspack-plugin' ), | ||
value: 'single-wide.php', | ||
}, | ||
] } | ||
onChange={ ( post_template_default: string ) => | ||
update( { post_template_default } ) | ||
} | ||
/> | ||
</Grid> | ||
); | ||
} |
Oops, something went wrong.