Skip to content

Commit

Permalink
fix(herobody): solves empty highlight deafult issue
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin authored and seaerchin committed Sep 13, 2023
1 parent 4dba335 commit 275ec6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/layouts/EditHomepage/EditHomepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,11 @@ const EditHomepage = ({ match }) => {
handleHighlightDropdownToggle={
handleHighlightDropdownToggle
}
initialSectionType={
section.hero.key_highlights
? "highlights"
: "dropdown"
}
>
{({ currentSelectedOption }) =>
currentSelectedOption === "dropdown" ? (
Expand Down
6 changes: 4 additions & 2 deletions src/layouts/components/Homepage/HeroBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface HeroBodyProps extends HeroBodyFormFields {
children: (props: {
currentSelectedOption: HeroSectionType
}) => React.ReactNode
initialSectionType: HeroSectionType
}

export const HeroBody = ({
Expand All @@ -62,9 +63,10 @@ export const HeroBody = ({
handleHighlightDropdownToggle,
notification,
children,
initialSectionType,
}: HeroBodyProps) => {
const [heroSectionType, setHeroSectionType] = useState<HeroSectionType>(
"highlights"
initialSectionType
)
const { onChange } = useEditableContext()

Expand Down Expand Up @@ -147,7 +149,7 @@ export const HeroBody = ({
},
})
}}
defaultValue="highlights"
defaultValue={initialSectionType}
>
<HStack spacing="2rem">
<Radio
Expand Down

0 comments on commit 275ec6e

Please sign in to comment.