Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(edithomepage): spread properly #1487

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/layouts/EditHomepage/EditHomepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,8 @@ const EditHomepage = ({ match }) => {
{({ currentSelectedOption }) =>
currentSelectedOption === "dropdown" ? (
<HeroDropdownSection
{...section.hero}
{...section.hero.dropdown}
state={section.hero}
errors={{
...errors,
...errors.sections[0].hero,
Expand All @@ -978,6 +978,7 @@ const EditHomepage = ({ match }) => {
...errors.sections[0].hero,
}}
highlights={section.hero.key_highlights}
{...section.hero}
/>
)
}
Expand Down
11 changes: 5 additions & 6 deletions src/layouts/components/Homepage/HeroDropdownSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ export interface HeroDropdownFormFields {
url: string
}

interface HeroDropdownSectionProps {
interface HeroDropdownSectionProps extends EditorHeroDropdownSection {
errors: {
dropdownElems: HeroDropdownFormFields[]
title: string
dropdown: string
}
state: EditorHeroDropdownSection
title: string
}

export const HeroDropdownSection = ({
errors,
state,
dropdown,
title,
}: HeroDropdownSectionProps) => {
const {
Expand Down Expand Up @@ -67,10 +66,10 @@ export const HeroDropdownSection = ({
<Editable.EmptySection
title="Options you add will appear here"
subtitle="Add options to allow users to quickly navigate your site"
isEmpty={state.dropdown.options.length === 0}
isEmpty={dropdown.options.length === 0}
>
<Editable.Section px={0} spacing="0.75rem" py="1.5rem">
{state.dropdown.options.map(
{dropdown.options.map(
(
{ title: optionTitle, url: optionUrl },
dropdownOptionIndex
Expand Down Expand Up @@ -145,7 +144,7 @@ export const HeroDropdownSection = ({
</Editable.Droppable>
</DragDropContext>
<Button
id={`dropdownelem-${state.dropdown.options.length}-create`}
id={`dropdownelem-${dropdown.options.length}-create`}
onClick={() => onCreate({ target: { id: "dropdownelem" } })}
variant="outline"
w="full"
Expand Down