diff --git a/src/layouts/EditHomepage/EditHomepage.jsx b/src/layouts/EditHomepage/EditHomepage.jsx index 382f4ce5f..21e22e53c 100644 --- a/src/layouts/EditHomepage/EditHomepage.jsx +++ b/src/layouts/EditHomepage/EditHomepage.jsx @@ -773,6 +773,22 @@ const EditHomepage = ({ match }) => { }) ) setDisplayAnnouncementItems(_.fill(Array(1), false)) + } else if (val.textcards) { + // Create 3 text cards by default + const parentId = + updatedHomepageState.frontMatter.sections.length - 1 + let intermediateHomepageState = updatedHomepageState + for (let i = 0; i < 3; i += 1) { + const cardVal = TEXTCARDS_ITEM_SECTION + const cardErr = getErrorValues(TEXTCARDS_ITEM_SECTION) + intermediateHomepageState = onCreate( + intermediateHomepageState, + `textCardItem-${parentId}`, + cardVal, + cardErr + ) + } + setHomepageState(intermediateHomepageState) } break } diff --git a/src/layouts/components/Homepage/AnnouncementBody.tsx b/src/layouts/components/Homepage/AnnouncementBody.tsx index b4db3263e..37487ae3d 100644 --- a/src/layouts/components/Homepage/AnnouncementBody.tsx +++ b/src/layouts/components/Homepage/AnnouncementBody.tsx @@ -72,7 +72,7 @@ export const AnnouncementBody = ({ - Announcements + Announcements {`You can display up to ${MAX_ANNOUNCEMENTS} announcements at a time. Newly added announcements are shown on the top of the list`} diff --git a/src/layouts/components/Homepage/AnnouncementSection.tsx b/src/layouts/components/Homepage/AnnouncementSection.tsx index 156e62984..5c29e99a4 100644 --- a/src/layouts/components/Homepage/AnnouncementSection.tsx +++ b/src/layouts/components/Homepage/AnnouncementSection.tsx @@ -51,7 +51,7 @@ export const AnnouncementSection = ({ /> {errors.title} - + {children}