@automattic/newspack-blocks 1.53.0 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/.cache/babel/1783de595f21d427355e559781275222.json.gz +0 -0
  2. package/.cache/babel/2a75259638488d555bb07fb4f54ddde6.json.gz +0 -0
  3. package/.cache/babel/{64cb5afd808420a679c0d56e7bdb7949.json.gz → 2dfe70bf8fa9218857f45826e2386a32.json.gz} +0 -0
  4. package/.cache/babel/2ef414e63685642b486b71a962a5cc09.json.gz +0 -0
  5. package/.cache/babel/5a94cdb1154d1770a8b0e8cd3145825b.json.gz +0 -0
  6. package/.cache/babel/678cc0f373236434bf692c16d26ba22f.json.gz +0 -0
  7. package/.cache/babel/71371fcf9db60a3a1e024991cb3b4bf3.json.gz +0 -0
  8. package/.cache/babel/725e695c6992a4d01573b83867255ea9.json.gz +0 -0
  9. package/.cache/babel/94ee8f45c55ecf01005a435ab588333b.json.gz +0 -0
  10. package/.cache/babel/a5759fe1915229088160b7f5eb8a2e75.json.gz +0 -0
  11. package/.cache/babel/{bdebf548c146fe858685d50dd0ebd031.json.gz → be383af4530fd3521ee3db177be1bbf4.json.gz} +0 -0
  12. package/.cache/babel/d298f58c94d221b643c4c009ea0d8002.json.gz +0 -0
  13. package/.cache/babel/dc7e2d653dbbdbd1939aa281435afa5d.json.gz +0 -0
  14. package/.cache/babel/f50f27ba4b367318e30e91dbe003e5c8.json.gz +0 -0
  15. package/CHANGELOG.md +35 -0
  16. package/dist/author-profile/view.asset.php +1 -1
  17. package/dist/author-profile/view.css +1 -1
  18. package/dist/author-profile/view.rtl.css +1 -1
  19. package/dist/carousel/view.asset.php +1 -1
  20. package/dist/carousel/view.css +1 -1
  21. package/dist/carousel/view.js +1 -1
  22. package/dist/carousel/view.rtl.css +1 -1
  23. package/dist/donate/view.asset.php +1 -1
  24. package/dist/donate/view.css +1 -1
  25. package/dist/donate/view.rtl.css +1 -1
  26. package/dist/donateStreamlined.asset.php +1 -1
  27. package/dist/donateStreamlined.js +1 -1
  28. package/dist/editor.asset.php +1 -1
  29. package/dist/editor.css +1 -1
  30. package/dist/editor.js +5 -5
  31. package/dist/editor.rtl.css +1 -1
  32. package/dist/homepage-articles/view.asset.php +1 -1
  33. package/dist/homepage-articles/view.css +1 -1
  34. package/dist/homepage-articles/view.rtl.css +1 -1
  35. package/dist/placeholder_blocks.asset.php +1 -0
  36. package/dist/placeholder_blocks.js +1 -0
  37. package/includes/class-newspack-blocks-api.php +14 -12
  38. package/includes/class-newspack-blocks-patterns.php +3 -2
  39. package/includes/class-newspack-blocks.php +64 -1
  40. package/newspack-blocks.php +3 -2
  41. package/package.json +17 -16
  42. package/src/block-patterns/homepage-posts-14.php +1 -1
  43. package/src/block-patterns/homepage-posts-2.php +1 -1
  44. package/src/block-patterns/homepage-posts-26.php +1 -1
  45. package/src/block-patterns/homepage-posts-31.php +13 -0
  46. package/src/block-patterns/homepage-posts-7.php +1 -1
  47. package/src/block-styles/core/columns/editor.scss +10 -10
  48. package/src/block-styles/core/columns/view.scss +8 -8
  49. package/src/block-styles/core/group/editor.scss +3 -3
  50. package/src/block-styles/core/group/view.scss +3 -3
  51. package/src/blocks/author-list/editor.scss +1 -1
  52. package/src/blocks/author-profile/edit.js +29 -6
  53. package/src/blocks/author-profile/editor.scss +4 -3
  54. package/src/blocks/author-profile/view.scss +9 -9
  55. package/src/blocks/carousel/edit.js +31 -15
  56. package/src/blocks/carousel/editor.scss +1 -1
  57. package/src/blocks/carousel/view.php +94 -87
  58. package/src/blocks/carousel/view.scss +52 -13
  59. package/src/blocks/donate/block.json +49 -0
  60. package/src/blocks/donate/edit.tsx +569 -0
  61. package/src/blocks/donate/editor.scss +68 -8
  62. package/src/blocks/donate/index.js +8 -41
  63. package/src/blocks/donate/streamlined/style.scss +17 -17
  64. package/src/blocks/donate/view.php +226 -174
  65. package/src/blocks/donate/view.scss +97 -114
  66. package/src/blocks/homepage-articles/edit.js +28 -22
  67. package/src/blocks/homepage-articles/editor.scss +5 -5
  68. package/src/blocks/homepage-articles/templates/article.php +78 -73
  69. package/src/blocks/homepage-articles/utils.ts +1 -3
  70. package/src/blocks/homepage-articles/view.scss +68 -40
  71. package/src/blocks/iframe/edit.js +18 -14
  72. package/src/blocks/iframe/editor.scss +3 -3
  73. package/src/blocks/video-playlist/editor.scss +2 -2
  74. package/src/setup/editor.scss +46 -4
  75. package/src/setup/placeholder-blocks.js +83 -0
  76. package/src/shared/sass/_mixins.scss +7 -5
  77. package/src/types/@wordpress/block-editor.d.ts +1 -0
  78. package/src/types/@wordpress/components.d.ts +1 -0
  79. package/src/types/{index.ts → index.d.ts} +5 -1
  80. package/src/types/newspack-components.d.ts +7 -0
  81. package/vendor/autoload.php +1 -1
  82. package/vendor/composer/autoload_real.php +4 -4
  83. package/vendor/composer/autoload_static.php +2 -2
  84. package/vendor/composer/installed.php +2 -2
  85. package/webpack.config.js +4 -0
  86. package/.cache/babel/07169c73863508b392f15022920bd0b6.json.gz +0 -0
  87. package/.cache/babel/10faf7c74a89e9aa4d8b9528a654913e.json.gz +0 -0
  88. package/.cache/babel/3fc03f1e35bc1fde55a903cf25d74d3d.json.gz +0 -0
  89. package/.cache/babel/553094e2be86910f765ad110c8da1ba1.json.gz +0 -0
  90. package/.cache/babel/55dd64fbb5126117016b9edff26ca5ee.json.gz +0 -0
  91. package/.cache/babel/7cbfe1b298fdc2a21add34363b2a6046.json.gz +0 -0
  92. package/.cache/babel/95c79f7af2e88cb1c48e88f304b1a1fd.json.gz +0 -0
  93. package/.cache/babel/ac3be6086bb961d3a94ba6ba7728901c.json.gz +0 -0
  94. package/.cache/babel/c9354785521531ea2b4a9a8c2f526abf.json.gz +0 -0
  95. package/.cache/babel/ca34d0586d4fbcd06c357ff72bda9a19.json.gz +0 -0
  96. package/.cache/babel/edb4dcd474dbafd6ea1655b24469e261.json.gz +0 -0
  97. package/src/blocks/donate/edit.js +0 -587
@@ -1 +1 @@
1
- @import './view.scss';
1
+ @use 'view.scss';
@@ -133,6 +133,7 @@ export const avatarSizeOptions = [
133
133
 
134
134
  const AuthorProfile = ( { attributes, setAttributes } ) => {
135
135
  const [ author, setAuthor ] = useState( null );
136
+ const [ suggestions, setSuggestions ] = useState( null );
136
137
  const [ error, setError ] = useState( null );
137
138
  const [ isLoading, setIsLoading ] = useState( false );
138
139
  const [ maxItemsToSuggest, setMaxItemsToSuggest ] = useState( 0 );
@@ -155,7 +156,7 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
155
156
  if ( 0 !== authorId ) {
156
157
  getAuthorById();
157
158
  }
158
- }, [ authorId, avatarHideDefault ] );
159
+ }, [ authorId, avatarHideDefault, isGuestAuthor ] );
159
160
 
160
161
  const getAuthorById = async () => {
161
162
  setError( null );
@@ -367,6 +368,7 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
367
368
  <SingleAuthor author={ author } attributes={ attributes } />
368
369
  ) : (
369
370
  <Placeholder
371
+ className="newspack-blocks-author-profile"
370
372
  icon={ <Icon icon={ postAuthor } /> }
371
373
  label={ __( 'Author Profile', 'newspack-blocks' ) }
372
374
  >
@@ -389,8 +391,11 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
389
391
  'newspack-blocks'
390
392
  ) }
391
393
  fetchSuggestions={ async ( search = null, offset = 0 ) => {
394
+ // Reset suggestions in state.
395
+ setSuggestions( null );
396
+
392
397
  // If we already have a selected author, no need to fetch suggestions.
393
- if ( authorId ) {
398
+ if ( authorId && ! error ) {
394
399
  return [];
395
400
  }
396
401
 
@@ -399,7 +404,6 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
399
404
  path: addQueryArgs( '/newspack-blocks/v1/authors', {
400
405
  search,
401
406
  offset,
402
- isGuestAuthor: true,
403
407
  fields: 'id,name',
404
408
  } ),
405
409
  } );
@@ -412,17 +416,36 @@ const AuthorProfile = ( { attributes, setAttributes } ) => {
412
416
  setMaxItemsToSuggest( total );
413
417
  }
414
418
 
415
- return authors.map( _author => ( {
419
+ const _suggestions = authors.map( _author => ( {
416
420
  value: _author.id,
417
421
  label: decodeEntities( _author.name ) || __( '(no name)', 'newspack' ),
418
422
  isGuestAuthor: _author.is_guest,
419
423
  } ) );
424
+
425
+ setSuggestions( _suggestions );
426
+
427
+ return _suggestions;
420
428
  } }
421
429
  maxItemsToSuggest={ maxItemsToSuggest }
422
430
  onChange={ items => {
431
+ let selectionIsGuest = false;
432
+ const selection = items[ 0 ];
433
+
434
+ // We need to check whether the selected author is a guest author or not.
435
+ if ( suggestions ) {
436
+ suggestions.forEach( suggestion => {
437
+ if (
438
+ parseInt( selection?.value ) === parseInt( suggestion?.value ) &&
439
+ suggestion?.isGuestAuthor
440
+ ) {
441
+ selectionIsGuest = true;
442
+ }
443
+ } );
444
+ }
445
+
423
446
  setAttributes( {
424
- authorId: parseInt( items[ 0 ]?.value || 0 ),
425
- isGuestAuthor: items[ 0 ]?.isGuestAuthor || false,
447
+ authorId: parseInt( selection?.value || 0 ),
448
+ isGuestAuthor: selectionIsGuest,
426
449
  } );
427
450
  } }
428
451
  postTypeLabel={ __( 'author', 'newspack-blocks' ) }
@@ -1,7 +1,8 @@
1
- @import './view';
1
+ @use 'view';
2
+ @use '../../shared/sass/mixins';
2
3
 
3
4
  .editor-styles-wrapper {
4
- .wp-block-newspack-blocks-author-profile {
5
+ .newspack-blocks-author-profile {
5
6
  .components-notice {
6
7
  margin: 0 0 2rem 0;
7
8
  width: 100%;
@@ -22,7 +23,7 @@
22
23
  }
23
24
 
24
25
  &__bio {
25
- @include media( mobile ) {
26
+ @include mixins.media( mobile ) {
26
27
  flex: 4;
27
28
 
28
29
  h3 {
@@ -1,8 +1,8 @@
1
- @import '../../shared/sass/variables';
2
- @import '../../shared/sass/mixins';
1
+ @use '../../shared/sass/variables';
2
+ @use '../../shared/sass/mixins';
3
3
 
4
4
  .wp-block-newspack-blocks-author-profile {
5
- @include media( mobile ) {
5
+ @include mixins.media( mobile ) {
6
6
  display: flex;
7
7
  }
8
8
 
@@ -31,7 +31,7 @@
31
31
  }
32
32
 
33
33
  &__avatar {
34
- @include media( mobile ) {
34
+ @include mixins.media( mobile ) {
35
35
  flex: 0 1 auto;
36
36
  margin-right: 1.5em;
37
37
  }
@@ -52,7 +52,7 @@
52
52
  }
53
53
 
54
54
  &__bio {
55
- @include media( mobile ) {
55
+ @include mixins.media( mobile ) {
56
56
  flex: 4;
57
57
 
58
58
  h3 {
@@ -78,7 +78,7 @@
78
78
  }
79
79
 
80
80
  svg {
81
- fill: currentColor;
81
+ fill: currentcolor;
82
82
  }
83
83
  }
84
84
 
@@ -86,9 +86,9 @@
86
86
  display: none;
87
87
  }
88
88
 
89
- // Avatar: Right
89
+ /* Avatar Right */
90
90
  &.avatar-right {
91
- @include media( mobile ) {
91
+ @include mixins.media( mobile ) {
92
92
  .wp-block-newspack-blocks-author-profile__avatar {
93
93
  margin-left: 1.5em;
94
94
  margin-right: 0;
@@ -97,7 +97,7 @@
97
97
  }
98
98
  }
99
99
 
100
- // Style: Center
100
+ /* Style Center */
101
101
  &.is-style-center {
102
102
  display: block;
103
103
 
@@ -285,16 +285,24 @@ class Edit extends Component {
285
285
  showAuthor ||
286
286
  showDate ) && (
287
287
  <div className="entry-wrapper">
288
- { post.newspack_post_sponsors && (
289
- <span className="cat-links sponsor-label">
290
- <span className="flag">{ post.newspack_post_sponsors[ 0 ].flag }</span>
291
- </span>
292
- ) }
293
- { showCategory &&
288
+ { ( post.newspack_post_sponsors || showCategory ) &&
294
289
  0 < post.newspack_category_info.length &&
295
- ! post.newspack_post_sponsors && (
296
- <div className="cat-links">
297
- <a href="#">{ decodeEntities( post.newspack_category_info ) }</a>
290
+ ( ! post.newspack_post_sponsors ||
291
+ post.newspack_sponsors_show_categories ) && (
292
+ <div
293
+ className={
294
+ 'cat-links' +
295
+ ( post.newspack_post_sponsors ? ' sponsor-label' : '' )
296
+ }
297
+ >
298
+ { post.newspack_post_sponsors && (
299
+ <span className="flag">
300
+ { post.newspack_post_sponsors[ 0 ].flag }
301
+ </span>
302
+ ) }
303
+ { showCategory && (
304
+ <a href="#">{ decodeEntities( post.newspack_category_info ) }</a>
305
+ ) }
298
306
  </div>
299
307
  ) }
300
308
  { showTitle && (
@@ -303,16 +311,24 @@ class Edit extends Component {
303
311
  </h3>
304
312
  ) }
305
313
  <div className="entry-meta">
306
- { post.newspack_post_sponsors &&
307
- formatSponsorLogos( post.newspack_post_sponsors ) }
308
- { post.newspack_post_sponsors &&
309
- formatSponsorByline( post.newspack_post_sponsors ) }
314
+ { post.newspack_post_sponsors && (
315
+ <span
316
+ className={ `entry-sponsors ${
317
+ post.newspack_sponsors_show_author ? 'plus-author' : ''
318
+ }` }
319
+ >
320
+ { formatSponsorLogos( post.newspack_post_sponsors ) }
321
+ { formatSponsorByline( post.newspack_post_sponsors ) }
322
+ </span>
323
+ ) }
310
324
  { showAuthor &&
311
325
  showAvatar &&
312
- ! post.newspack_post_sponsors &&
326
+ ( ! post.newspack_post_sponsors ||
327
+ post.newspack_sponsors_show_author ) &&
313
328
  formatAvatars( post.newspack_author_info ) }
314
329
  { showAuthor &&
315
- ! post.newspack_post_sponsors &&
330
+ ( ! post.newspack_post_sponsors ||
331
+ post.newspack_sponsors_show_author ) &&
316
332
  formatByline( post.newspack_author_info ) }
317
333
  { showDate && (
318
334
  <time className="entry-date published" key="pub-date">
@@ -1,4 +1,4 @@
1
- @import '../../shared/sass/placeholder';
1
+ @use '../../shared/sass/placeholder';
2
2
 
3
3
  .wpnbpc {
4
4
  .swiper-wrapper {
@@ -103,35 +103,34 @@ function newspack_blocks_render_block_carousel( $attributes ) {
103
103
 
104
104
  <?php if ( ! empty( $sponsors ) || $attributes['showCategory'] || $attributes['showTitle'] || $show_author || $show_date ) : ?>
105
105
  <div class="entry-wrapper">
106
- <?php if ( ! empty( $sponsors ) ) : ?>
107
- <span class="cat-links sponsor-label">
108
- <span class="flag">
109
- <?php echo esc_html( Newspack_Blocks::get_sponsor_label( $sponsors ) ); ?>
110
- </span>
111
- </span>
112
- <?php
113
- else :
114
- $category = false;
106
+ <?php if ( ! empty( $sponsors ) || $attributes['showCategory'] ) : ?>
107
+ <div class="cat-links <?php if ( ! empty( $sponsors ) ) : ?>sponsor-label<?php endif; // phpcs:ignore Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace ?>">
108
+ <?php if ( ! empty( $sponsors ) ) : ?>
109
+ <span class="flag">
110
+ <?php echo esc_html( Newspack_Blocks::get_sponsor_label( $sponsors ) ); ?>
111
+ </span>
112
+ <?php
113
+ endif;
114
+ $category = false;
115
115
 
116
- // Use Yoast primary category if set.
117
- if ( class_exists( 'WPSEO_Primary_Term' ) ) {
118
- $primary_term = new WPSEO_Primary_Term( 'category', $post_id );
119
- $category_id = $primary_term->get_primary_term();
120
- if ( $category_id ) {
121
- $category = get_term( $category_id );
116
+ // Use Yoast primary category if set.
117
+ if ( class_exists( 'WPSEO_Primary_Term' ) ) {
118
+ $primary_term = new WPSEO_Primary_Term( 'category', $post_id );
119
+ $category_id = $primary_term->get_primary_term();
120
+ if ( $category_id ) {
121
+ $category = get_term( $category_id );
122
+ }
122
123
  }
123
- }
124
124
 
125
- if ( ! $category ) {
126
- $categories_list = get_the_category();
127
- if ( ! empty( $categories_list ) ) {
128
- $category = $categories_list[0];
125
+ if ( ! $category ) {
126
+ $categories_list = get_the_category();
127
+ if ( ! empty( $categories_list ) ) {
128
+ $category = $categories_list[0];
129
+ }
129
130
  }
130
- }
131
131
 
132
- if ( $attributes['showCategory'] && $category ) :
133
- ?>
134
- <div class="cat-links">
132
+ if ( $attributes['showCategory'] && $category && ( empty( $sponsors ) || Newspack_Blocks::newspack_display_sponsors_and_categories( $sponsors ) ) ) :
133
+ ?>
135
134
  <?php $category_link = get_category_link( $category->term_id ); ?>
136
135
  <?php if ( ! empty( $category_link ) ) : ?>
137
136
  <a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
@@ -139,14 +138,14 @@ function newspack_blocks_render_block_carousel( $attributes ) {
139
138
  <?php echo esc_html( $category->name ); ?>
140
139
  <?php if ( ! empty( $category_link ) ) : ?>
141
140
  </a>
142
- <?php endif; ?>
141
+ <?php
142
+ endif;
143
+ endif;
144
+ ?>
143
145
  </div>
144
- <?php
145
- endif;
146
+ <?php
146
147
  endif;
147
- ?>
148
148
 
149
- <?php
150
149
  if ( $attributes['showTitle'] ) {
151
150
  the_title( '<h3 class="entry-title"><a href="' . esc_url( $post_link ) . '" rel="bookmark">', '</a></h3>' );
152
151
  }
@@ -155,70 +154,78 @@ function newspack_blocks_render_block_carousel( $attributes ) {
155
154
  <div class="entry-meta">
156
155
  <?php
157
156
  if ( ! empty( $sponsors ) ) :
158
- $logos = Newspack_Blocks::get_sponsor_logos( $sponsors );
159
- if ( ! empty( $logos ) ) :
160
- ?>
161
- <span class="sponsor-logos">
157
+ $sponsor_classes[] = 'entry-sponsors';
158
+ if ( Newspack_Blocks::newspack_display_sponsors_and_authors( $sponsors ) ) {
159
+ $sponsor_classes[] = 'plus-author';
160
+ }
161
+ ?>
162
+ <span class="<?php echo esc_attr( implode( ' ', $sponsor_classes ) ); ?>">
162
163
  <?php
163
- foreach ( $logos as $logo ) {
164
- if ( '' !== $logo['url'] ) {
165
- echo '<a href="' . esc_url( $logo['url'] ) . '" target="_blank">';
166
- }
167
- echo '<img src="' . esc_url( $logo['src'] ) . '" alt="' . esc_attr( $logo['alt'] ) . '" width="' . esc_attr( $logo['width'] ) . '" height="' . esc_attr( $logo['height'] ) . '">';
168
- if ( '' !== $logo['url'] ) {
169
- echo '</a>';
164
+ $logos = Newspack_Blocks::get_sponsor_logos( $sponsors );
165
+ if ( ! empty( $logos ) ) :
166
+ ?>
167
+ <span class="sponsor-logos">
168
+ <?php
169
+ foreach ( $logos as $logo ) {
170
+ if ( '' !== $logo['url'] ) {
171
+ echo '<a href="' . esc_url( $logo['url'] ) . '" target="_blank">';
172
+ }
173
+ echo '<img src="' . esc_url( $logo['src'] ) . '" alt="' . esc_attr( $logo['alt'] ) . '" width="' . esc_attr( $logo['width'] ) . '" height="' . esc_attr( $logo['height'] ) . '">';
174
+ if ( '' !== $logo['url'] ) {
175
+ echo '</a>';
176
+ }
170
177
  }
171
- }
172
- ?>
173
- </span>
174
- <?php endif; ?>
178
+ ?>
179
+ </span>
180
+ <?php endif; ?>
175
181
 
176
- <span class="byline sponsor-byline">
177
- <?php
178
- $bylines = Newspack_Blocks::get_sponsor_byline( $sponsors );
179
- echo esc_html( $bylines[0]['byline'] ) . ' ';
180
- foreach ( $bylines as $byline ) {
181
- echo '<span class="author">';
182
- if ( '' !== $byline['url'] ) {
183
- echo '<a target="_blank" href="' . esc_url( $byline['url'] ) . '">';
182
+ <span class="byline sponsor-byline">
183
+ <?php
184
+ $bylines = Newspack_Blocks::get_sponsor_byline( $sponsors );
185
+ echo esc_html( $bylines[0]['byline'] ) . ' ';
186
+ foreach ( $bylines as $byline ) {
187
+ echo '<span class="author">';
188
+ if ( '' !== $byline['url'] ) {
189
+ echo '<a target="_blank" href="' . esc_url( $byline['url'] ) . '">';
190
+ }
191
+ echo esc_html( $byline['name'] );
192
+ if ( '' !== $byline['url'] ) {
193
+ echo '</a>';
194
+ }
195
+ echo '</span>' . esc_html( $byline['sep'] );
184
196
  }
185
- echo esc_html( $byline['name'] );
186
- if ( '' !== $byline['url'] ) {
187
- echo '</a>';
188
- }
189
- echo '</span>' . esc_html( $byline['sep'] );
190
- }
191
- ?>
192
- </span>
197
+ ?>
198
+ </span>
199
+ </span><!-- .entry-sponsors -->
193
200
  <?php
194
- else :
195
- if ( $show_author ) :
196
- if ( $attributes['showAvatar'] ) :
197
- echo wp_kses(
198
- newspack_blocks_format_avatars( $authors ),
199
- array(
200
- 'img' => array(
201
- 'class' => true,
202
- 'src' => true,
203
- 'alt' => true,
204
- 'width' => true,
205
- 'height' => true,
206
- 'data-*' => true,
207
- 'srcset' => true,
208
- ),
209
- 'noscript' => array(),
210
- 'a' => array(
211
- 'href' => true,
212
- ),
213
- )
214
- );
215
- endif;
216
- ?>
217
- <span class="byline">
218
- <?php echo wp_kses_post( newspack_blocks_format_byline( $authors ) ); ?>
219
- </span><!-- .author-name -->
220
- <?php
201
+ endif;
202
+
203
+ if ( $show_author && ( empty( $sponsors ) || Newspack_Blocks::newspack_display_sponsors_and_authors( $sponsors ) ) ) :
204
+ if ( $attributes['showAvatar'] ) :
205
+ echo wp_kses(
206
+ newspack_blocks_format_avatars( $authors ),
207
+ array(
208
+ 'img' => array(
209
+ 'class' => true,
210
+ 'src' => true,
211
+ 'alt' => true,
212
+ 'width' => true,
213
+ 'height' => true,
214
+ 'data-*' => true,
215
+ 'srcset' => true,
216
+ ),
217
+ 'noscript' => array(),
218
+ 'a' => array(
219
+ 'href' => true,
220
+ ),
221
+ )
222
+ );
221
223
  endif;
224
+ ?>
225
+ <span class="byline">
226
+ <?php echo wp_kses_post( newspack_blocks_format_byline( $authors ) ); ?>
227
+ </span><!-- .author-name -->
228
+ <?php
222
229
  endif;
223
230
  if ( $show_date ) :
224
231
  printf(
@@ -1,7 +1,7 @@
1
- @import '../../shared/sass/variables';
2
- @import '../../shared/sass/mixins';
3
- @import '../../shared/sass/colors';
4
- @import '../../shared/sass/preview';
1
+ @use '../../shared/sass/variables';
2
+ @use '../../shared/sass/mixins';
3
+ @use '../../shared/sass/colors';
4
+ @use '../../shared/sass/preview';
5
5
 
6
6
  .wpnbpc {
7
7
  position: relative;
@@ -42,7 +42,7 @@
42
42
  width: 1.8em;
43
43
  }
44
44
 
45
- @include media( tablet ) {
45
+ @include mixins.media( tablet ) {
46
46
  .entry-title {
47
47
  font-size: 1.6em;
48
48
  }
@@ -98,7 +98,7 @@
98
98
  }
99
99
  &__placeholder {
100
100
  height: 420px;
101
- background: $color__background-screen;
101
+ background: colors.$color__background-screen;
102
102
  }
103
103
  p {
104
104
  white-space: normal;
@@ -135,7 +135,7 @@
135
135
  }
136
136
 
137
137
  span {
138
- @include visuallyHidden;
138
+ @include mixins.visuallyHidden;
139
139
  }
140
140
  }
141
141
  .swiper-button,
@@ -170,7 +170,7 @@
170
170
  display: none;
171
171
  right: auto;
172
172
 
173
- @include media( mobile ) {
173
+ @include mixins.media( mobile ) {
174
174
  display: block;
175
175
  }
176
176
  }
@@ -238,7 +238,7 @@
238
238
 
239
239
  /* Image styles */
240
240
  figcaption {
241
- font-size: $font__size-xxs;
241
+ font-size: variables.$font__size-xxs;
242
242
  }
243
243
 
244
244
  /* Headings */
@@ -265,6 +265,15 @@
265
265
  font-size: 0.6em;
266
266
  font-weight: bold;
267
267
  margin: 0 0 0.5em;
268
+
269
+ &.sponsor-label {
270
+ align-items: center;
271
+
272
+ .flag + a {
273
+ margin-left: 0.5em;
274
+ }
275
+ }
276
+
268
277
  a {
269
278
  text-decoration: none;
270
279
  }
@@ -274,6 +283,7 @@
274
283
  display: block;
275
284
  margin-right: 0.5em;
276
285
  }
286
+
277
287
  &.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,
278
288
  &.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause,
279
289
  .amp-carousel-button-play,
@@ -310,7 +320,7 @@
310
320
 
311
321
  &[data-slides-per-view='2'] article {
312
322
  .entry-title {
313
- @include media( tablet ) {
323
+ @include mixins.media( tablet ) {
314
324
  font-size: 1.4em;
315
325
  }
316
326
  }
@@ -319,17 +329,46 @@
319
329
  &.slides-per-view-3 article,
320
330
  &.slides-per-view-4 article {
321
331
  .entry-title {
322
- @include media( tablet ) {
332
+ @include mixins.media( tablet ) {
323
333
  font-size: 1.2em;
324
334
  }
325
- @include media( desktop ) {
335
+ @include mixins.media( desktop ) {
326
336
  font-size: 1em;
327
337
  }
328
338
  }
329
339
  .entry-meta {
330
- @include media( tablet ) {
340
+ @include mixins.media( tablet ) {
331
341
  font-size: 0.7em;
332
342
  }
333
343
  }
334
344
  }
335
345
  }
346
+
347
+ /* stylelint-disable selector-type-no-unknown */
348
+ .wpnbpc,
349
+ amp-script .wpnbpc {
350
+ .entry-sponsors {
351
+ align-items: center;
352
+ display: inline-flex;
353
+ flex-wrap: wrap;
354
+ gap: 0.5em;
355
+ width: 100%;
356
+
357
+ &.plus-author {
358
+ font-size: 0.9em;
359
+
360
+ &:not( :last-child ) {
361
+ margin-bottom: 0.5rem;
362
+ }
363
+ }
364
+ }
365
+
366
+ .sponsor-logos {
367
+ align-items: center;
368
+ display: inline-flex;
369
+ flex-wrap: wrap;
370
+ gap: 0.5em;
371
+ line-height: 1;
372
+ }
373
+ }
374
+ /* stylelint-enable */
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "donate",
3
+ "category": "newspack",
4
+ "attributes": {
5
+ "className": {
6
+ "type": "string"
7
+ },
8
+ "manual": {
9
+ "type": "boolean"
10
+ },
11
+ "tiered": {
12
+ "type": "boolean",
13
+ "default": true
14
+ },
15
+ "amounts": {
16
+ "type": "object",
17
+ "default": {}
18
+ },
19
+ "disabledFrequencies": {
20
+ "type": "object",
21
+ "default": {}
22
+ },
23
+ "thanksText": {
24
+ "type": "string",
25
+ "default": "Your contribution is appreciated."
26
+ },
27
+ "buttonText": {
28
+ "type": "string",
29
+ "default": "Donate Now"
30
+ },
31
+ "defaultFrequency": {
32
+ "type": "string",
33
+ "default": "month"
34
+ },
35
+ "campaign": {
36
+ "type": "string"
37
+ },
38
+ "suggestedAmounts": {
39
+ "type": "array"
40
+ },
41
+ "suggestedAmountUntiered": {
42
+ "type": "number"
43
+ }
44
+ },
45
+ "supports": {
46
+ "html": false,
47
+ "align": false
48
+ }
49
+ }