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

feat(heroimageonlylayout): add dropdown #1494

Merged
merged 2 commits into from
Sep 20, 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
34 changes: 32 additions & 2 deletions src/templates/homepage/HeroSection/HeroImageOnlyLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@ import editorStyles from "styles/isomer-cms/pages/Editor.module.scss"

import { getClassNames } from "templates/utils/stylingUtils"

export const HeroImageOnlyLayout = () => {
import { EditorHeroDropdownSection } from "types/homepage"

import { HeroDropdown } from "./HeroDropdown"

interface HeroImageOnlyLayoutProps {
dropdown?: EditorHeroDropdownSection["dropdown"]
dropdownIsActive: boolean
toggleDropdown: () => void
}
export const HeroImageOnlyLayout = ({
dropdown,
dropdownIsActive,
toggleDropdown,
}: HeroImageOnlyLayoutProps) => {
return (
<div
className={getClassNames(editorStyles, ["bp-hero-body, with-padding"])}
Expand All @@ -21,7 +34,24 @@ export const HeroImageOnlyLayout = () => {
"ma",
])}
>
<div className={getClassNames(editorStyles, ["min-height-mobile"])} />
<div
className={getClassNames(editorStyles, [
"min-height-mobile",
"is-flex",
"row",
"is-vcentered",
"is-centered",
])}
>
{dropdown && (
<HeroDropdown
title={dropdown.title}
options={dropdown.options}
isActive={dropdownIsActive}
toggleDropdown={toggleDropdown}
/>
)}
</div>
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/templates/homepage/HeroSection/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ export const TemplateHeroSection = forwardRef<
toggleDropdown={toggleDropdown}
/>
)}
{variant === "image" && <HeroImageOnlyLayout />}
{variant === "image" && (
<HeroImageOnlyLayout
dropdown={hero.dropdown}
dropdownIsActive={dropdownIsActive}
toggleDropdown={toggleDropdown}
/>
)}
{variant === "side" && (
<HeroSideLayout
{...hero}
Expand Down
Loading