diff --git a/src/blocks/blocks/posts/edit.js b/src/blocks/blocks/posts/edit.js
index 12155b196..5d2f9a2bc 100644
--- a/src/blocks/blocks/posts/edit.js
+++ b/src/blocks/blocks/posts/edit.js
@@ -64,6 +64,67 @@ import { styles } from './constants.js';
const { attributes: defaultAttributes } = metadata;
+const Preview = ({
+ posts,
+ categoriesList,
+ authors,
+ blockProps,
+ inlineStyles,
+ attributes,
+ isLoading
+}) => {
+ if ( ! posts || ! categoriesList || ! authors || isLoading ) {
+ return (
+
+
+
+ { __( 'Loading Posts', 'otter-blocks' ) }
+
+
+ );
+ }
+
+ if ( 0 === posts.length ) {
+ return (
+
+
+ { __( 'No Posts', 'otter-blocks' ) }
+
+
+ );
+ }
+ const featuredPost = posts?.[0];
+ const featuredPostAuthor = authors?.find(
+ ( author ) => author?.id === featuredPost?.author
+ );
+
+ return (
+
+
+ { attributes.enableFeaturedPost && (
+
+ ) }
+
+
+
+
+ {
+ attributes.hasPagination &&
+ }
+
+ );
+};
+
/**
* Posts component
* @param {import('./types').PostProps} param0
@@ -307,62 +368,6 @@ const Edit = ({
const blockProps = useBlockProps();
- const Preview = ({
- posts,
- categoriesList,
- authors,
- blockProps,
- inlineStyles,
- attributes
- }) => {
- if ( ! posts || ! categoriesList || ! authors || isLoading ) {
- return (
-
-
-
- { __( 'Loading Posts', 'otter-blocks' ) }
-
-
- );
- }
-
- if ( 0 === posts.length ) {
- return (
-
-
- { __( 'No Posts', 'otter-blocks' ) }
-
-
- );
- }
-
- return (
-
-
- { attributes.enableFeaturedPost && (
-
- ) }
-
-
-
-
- {
- attributes.hasPagination &&
- }
-
- );
- };
-
return (
{ categoriesList && (
@@ -386,6 +391,7 @@ const Edit = ({
blockProps={ blockProps }
inlineStyles={ inlineStyles }
attributes={ attributes }
+ isLoading={ isLoading }
/>
);