Skip to content

Commit

Permalink
fix(hero): update panel styles for hero section (#1543)
Browse files Browse the repository at this point in the history
* fix(herosidelayout): default to white bg

* fix(herobody): style fixes

* fix(hero): style fixes

* fix(hero-image-only): change styling on small screens

---------

Co-authored-by: seaerchin <[email protected]>
  • Loading branch information
seaerchin and seaerchin authored Oct 3, 2023
1 parent 55e0684 commit 86e2ac6
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 40 deletions.
31 changes: 16 additions & 15 deletions src/layouts/components/Homepage/HeroBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const HeroSideSectionLayout = ({
title={title}
subtitle={subtitle}
/>
<Box>
<Box w="100%">
<Text textStyle="subhead-1">Section size</Text>
<Radio.RadioGroup
onChange={(nextSectionSize) => {
Expand All @@ -218,11 +218,11 @@ const HeroSideSectionLayout = ({
>
<HStack spacing="0.5rem">
<Radio value="50%" size="xs" w="50%" allowDeselect={false}>
Half (1/2) of banner
Wide
</Radio>
<Spacer />
<Radio value="33%" size="xs" w="50%" allowDeselect={false}>
Third (1/3) of banner
Narrow
</Radio>
</HStack>
</Radio.RadioGroup>
Expand Down Expand Up @@ -253,24 +253,24 @@ const HeroSideSectionLayout = ({
</Box>
<Box w="100%">
<Text textStyle="subhead-1">Section background colour</Text>
<HStack spacing="0.75rem" alignItems="flex-start">
<Tooltip label="black" hasArrow>
<HStack mt="0.5rem" spacing="0.75rem" alignItems="flex-start">
<Tooltip label="White" hasArrow>
<IconButton
{...getIconButtonProps("black")}
onClick={() => onIconButtonClick("black")}
{...getIconButtonProps("white")}
onClick={() => onIconButtonClick("white")}
>
<Icon as={BiInfoCircle} fill="black" fontSize="1rem" />
<Icon as={BiInfoCircle} fill="white" fontSize="1rem" />
</IconButton>
</Tooltip>
<Tooltip label="white" hasArrow>
<Tooltip label="Black" hasArrow>
<IconButton
{...getIconButtonProps("white")}
onClick={() => onIconButtonClick("white")}
{...getIconButtonProps("black")}
onClick={() => onIconButtonClick("black")}
>
<Icon as={BiInfoCircle} fill="white" fontSize="1rem" />
<Icon as={BiInfoCircle} fill="black" fontSize="1rem" />
</IconButton>
</Tooltip>
<Tooltip label="translucent gray" hasArrow>
<Tooltip label="Translucent grey" hasArrow>
<IconButton
{...getIconButtonProps("gray")}
onClick={() => onIconButtonClick("gray")}
Expand Down Expand Up @@ -313,7 +313,7 @@ const HeroLayoutForm = ({
}, [inView, showNewLayouts])

return (
<Box>
<Box w="100%">
{showFeatureTour && (
<Box>
<FeatureTourHandler
Expand All @@ -332,6 +332,7 @@ const HeroLayoutForm = ({
<FormLabel textStyle="subhead-1">Layout</FormLabel>
<SingleSelect
isClearable={false}
isSearchable={false}
name="hero layout options"
value={variant}
items={_.values(HERO_LAYOUTS)}
Expand Down Expand Up @@ -452,7 +453,7 @@ export const HeroBody = ({
<Text textStyle="h5" mb="0.75rem">
Hero Interactions
</Text>
<Text textStyle="subhead-2" mb="0.25rem">
<Text textStyle="subhead-1" mb="0.25rem">
Content type
</Text>
<Radio.RadioGroup
Expand Down
4 changes: 4 additions & 0 deletions src/styles/isomer-template/components/homepage/_hero.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.border-solid-gray {
border: 1px solid $border-light;
}

.min-height-mobile {
min-height: 398px;
}
Expand Down
1 change: 1 addition & 0 deletions src/styles/isomer-template/theme/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ $utility-secondary-color: var(--site-secondary-color);
$canvas-translucent-grey: #00000080;
$interaction-hover: #f9f9f9;
$stroke-default: #d0d5dd;
$border-light: #d6d6d6;
9 changes: 9 additions & 0 deletions src/styles/isomer-template/theme/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@
.w-100 {
width: 100%;
}

.is-full-width {
width: 100%;
}

.is-vh-centered {
align-items: center;
justify-content: center;
}
2 changes: 1 addition & 1 deletion src/templates/homepage/HeroSection/HeroCenteredLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const HeroCenteredLayout = ({
</p>
) : null}
{/* Hero dropdown */}
{hero.dropdown ? (
{hero.dropdown.title ? (
<HeroDropdown
title={hero.dropdown.title}
options={hero.dropdown.options}
Expand Down
3 changes: 2 additions & 1 deletion src/templates/homepage/HeroSection/HeroDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const HeroDropdown = ({
<div
className={getClassNames(editorStyles, [
"bp-dropdown",
"margin--top--sm",
`${isActive ? "is-active" : null}`,
"border-solid-gray",
"is-full-width",
])}
>
<div className={editorStyles["bp-dropdown-trigger"]}>
Expand Down
39 changes: 20 additions & 19 deletions src/templates/homepage/HeroSection/HeroImageOnlyLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,53 @@ import { getClassNames } from "templates/utils/stylingUtils"

import { EditorHeroDropdownSection } from "types/homepage"

import { HeroButton } from "./HeroButton"
import { HeroDropdown } from "./HeroDropdown"

interface HeroImageOnlyLayoutProps {
dropdown?: EditorHeroDropdownSection["dropdown"]
button?: string
dropdownIsActive: boolean
toggleDropdown: () => void
}
export const HeroImageOnlyLayout = ({
dropdown,
button,
dropdownIsActive,
toggleDropdown,
}: HeroImageOnlyLayoutProps) => {
return (
<div
className={getClassNames(editorStyles, ["bp-hero-body, with-padding"])}
className={getClassNames(editorStyles, [
"bp-hero-body, hero-body-padding",
])}
>
<div
className={getClassNames(editorStyles, [
"bp-container",
"margin--top--lg",
])}
>
<div
className={getClassNames(editorStyles, [
"row",
"is-vcentered",
"is-centered",
"ma",
])}
>
<div className={getClassNames(editorStyles, ["row"])}>
<div
className={getClassNames(editorStyles, [
"min-height-mobile",
"is-flex",
"row",
"is-vcentered",
"is-centered",
"is-full-width",
"is-vh-centered",
])}
>
{dropdown && (
<HeroDropdown
title={dropdown.title}
options={dropdown.options}
isActive={dropdownIsActive}
toggleDropdown={toggleDropdown}
/>
{dropdown?.title ? (
<div className={getClassNames(editorStyles, ["col", "is-9"])}>
<HeroDropdown
title={dropdown.title}
options={dropdown.options}
isActive={dropdownIsActive}
toggleDropdown={toggleDropdown}
/>
</div>
) : (
<HeroButton button={button} />
)}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/templates/homepage/HeroSection/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const TemplateHeroSection = forwardRef<
)}
{variant === "image" && (
<HeroImageOnlyLayout
button={hero.button}
dropdown={hero.dropdown}
dropdownIsActive={dropdownIsActive}
toggleDropdown={toggleDropdown}
Expand Down
9 changes: 5 additions & 4 deletions src/templates/homepage/HeroSection/HeroSideLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const HeroInfoboxDesktop = ({
)}
</div>

{dropdown ? (
{dropdown?.title ? (
<div
className={getClassNames(editorStyles, ["is-flex"])}
style={{
Expand Down Expand Up @@ -119,7 +119,7 @@ export const HeroSideLayout = ({
title,
subtitle,
button,
backgroundColor,
backgroundColor = "white",
dropdownIsActive,
toggleDropdown,
dropdown,
Expand Down Expand Up @@ -173,10 +173,11 @@ export const HeroSideLayout = ({
<div
className={getClassNames(editorStyles, [
"p-8",
"row",
"is-vcentered",
"is-centered",
"is-flex",
"col",
"is-9",
])}
style={{
flexDirection: "column",
Expand All @@ -191,7 +192,7 @@ export const HeroSideLayout = ({
</b>
</h1>
</div>
{dropdown ? (
{dropdown?.title ? (
<HeroDropdown
title={dropdown.title}
options={dropdown.options}
Expand Down

0 comments on commit 86e2ac6

Please sign in to comment.