Skip to content

Commit

Permalink
update props naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Buczacka authored and Walter Buczacka committed Apr 25, 2024
1 parent 425dbb5 commit 41b7ca8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
15 changes: 9 additions & 6 deletions packages/next/cms/components/ProfileRenderer.js
Expand Up @@ -44,8 +44,9 @@ function ProfileRenderer({
customSections = {},
relatedTile,
t,
opened,
handlers,
searchOpened,
searchHandlers,
defaultOpened,
}) {
const router = useRouter();
const {query} = router;
Expand Down Expand Up @@ -123,8 +124,9 @@ function ProfileRenderer({
}}
>
<Hero
opened={opened}
handlers={handlers}
searchOpened={searchOpened}
searchHandlers={searchHandlers}
defaultOpened={defaultOpened}
key="cp-hero"
profile={profile}
contents={heroSection || null}
Expand All @@ -139,8 +141,9 @@ function ProfileRenderer({
comparison
&& (
<Hero
opened={opened}
handlers={handlers}
searchOpened={searchOpened}
searchHandlers={searchHandlers}
defaultOpened={defaultOpened}
key="cp-hero-comparison"
profile={comparison}
contents={comparison.sections.find((l) => l.type === "Hero") || null}
Expand Down
14 changes: 7 additions & 7 deletions packages/next/cms/components/sections/Hero.js
Expand Up @@ -44,8 +44,8 @@ function Hero({
sources,
type,
defaultOpened,
opened,
handlers = {},
searchOpened,
searchHandlers = {},
}) {
// NOTE: using color scheme here asumes there is theme switch enabled
// const {colorScheme} = useMantineColorScheme();
Expand All @@ -59,11 +59,11 @@ function Hero({
} = useContext(ProfileContext);
const {stripHTML = (d) => d} = formatters || {};

const isOpenControlled = () => opened != null;
const isOpenControlled = () => searchOpened != null;

const titleClick = (index) => {
if (typeof handlers.toggle === "function") {
handlers.toggle();
if (typeof searchHandlers.toggle === "function") {
searchHandlers.toggle();
}

if (!isOpenControlled()) {
Expand Down Expand Up @@ -324,8 +324,8 @@ function Hero({
...searchProps?.modalProps || {},
// not-overridable
className: "cp-hero-search",
opened: isOpenControlled() ? opened : clickedIndex !== undefined,
onClose: isOpenControlled() ? () => handlers.close() : () => setClickedIndex(undefined),
opened: isOpenControlled() ? searchOpened : clickedIndex !== undefined,
onClose: isOpenControlled() ? () => searchHandlers.close() : () => setClickedIndex(undefined),
}}
/>
</Stack>
Expand Down

0 comments on commit 41b7ca8

Please sign in to comment.