Skip to content
Merged
1 change: 0 additions & 1 deletion packages/visual-editor/locales/cs/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/da/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/de/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/en-GB/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/en/visual-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@
"small_text size": "Small",
"spotlight": "Spotlight",
"start": "Start",
"sticky": "Sticky",
"sunday": "Sunday",
"three": "Three",
"thursday": "Thursday",
Expand Down
1 change: 0 additions & 1 deletion packages/visual-editor/locales/es/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/et/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/fi/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/fr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/hr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/hu/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/it/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/ja/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/lt/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/lv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/nb/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/nl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/pl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/pt/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/ro/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/sk/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/sv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/tr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/visual-editor/locales/zh/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export const directoryConfig: Config<DirectoryConfigProps> = {
return (
<DropZone
zone="default-zone"
style={{ display: "flex", flexDirection: "column", height: "100vh" }}
style={{
display: "flex",
flexDirection: "column",
minHeight: "100vh",
}}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export const locatorConfig: Config<LocatorConfigProps> = {
return (
<DropZone
zone="default-zone"
style={{ display: "flex", flexDirection: "column", height: "100vh" }}
style={{
display: "flex",
flexDirection: "column",
minHeight: "100vh",
}}
/>
);
},
Expand Down
6 changes: 5 additions & 1 deletion packages/visual-editor/src/components/configs/mainConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export const mainConfig: Config<MainConfigProps> = {
return (
<DropZone
zone="default-zone"
style={{ display: "flex", flexDirection: "column", height: "100vh" }}
style={{
display: "flex",
flexDirection: "column",
minHeight: "100vh",
}}
disallow={AdvancedCoreInfoCategory.filter((k) => k !== "Grid")}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/visual-editor/src/components/directory/Directory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const DirectoryComponent: PuckComponent<DirectoryProps> = ({
<Background background={styles.backgroundColor}>
<slots.BreadcrumbsSlot style={{ height: "auto" }} />
<PageSection className="flex flex-col items-center gap-2">
<slots.SiteNameSlot style={{ height: "auto" }} />
<slots.TitleSlot style={{ height: "auto" }} />
<slots.SiteNameSlot style={{ height: "auto", width: "100%" }} />
<slots.TitleSlot style={{ height: "auto", width: "100%" }} />
</PageSection>
{streamDocument.dm_directoryChildren &&
isDirectoryGrid(streamDocument.dm_directoryChildren) && (
Expand Down
35 changes: 5 additions & 30 deletions packages/visual-editor/src/components/header/ExpandedHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { defaultSecondaryHeaderProps } from "./SecondaryHeaderSlot.tsx";
export const headerWrapper = cva("flex flex-col", {
variants: {
position: {
sticky: "sticky top-0 z-50",
fixed: "fixed top-0 left-0 right-0 z-50",
// We use 'sticky' for fixed so that content does not overlap at the top of the page
fixed: "sticky top-0 z-50",
scrollsWithPage: "",
},
},
Expand All @@ -28,8 +28,8 @@ export const headerWrapper = cva("flex flex-col", {
export interface ExpandedHeaderStyles {
/** The maximum width of the header */
maxWidth: PageSectionProps["maxWidth"];
/** Whether the header is "sticky" or not */
headerPosition: "sticky" | "fixed" | "scrollsWithPage";
/** Whether the header is fixed to the top of the page or not */
headerPosition: "fixed" | "scrollsWithPage";
}

export interface ExpandedHeaderProps {
Expand Down Expand Up @@ -73,7 +73,6 @@ const expandedHeaderSectionFields: Fields<ExpandedHeaderProps> = {
label: msg("fields.options.scrollsWithPage", "Scrolls with Page"),
value: "scrollsWithPage",
},
{ label: msg("fields.options.sticky", "Sticky"), value: "sticky" },
{ label: msg("fields.options.fixed", "Fixed"), value: "fixed" },
],
}
Expand Down Expand Up @@ -103,33 +102,9 @@ const ExpandedHeaderWrapper: PuckComponent<ExpandedHeaderProps> = ({
styles,
slots,
}) => {
const headerRef = React.useRef<HTMLDivElement>(null);
const [headerHeight, setHeaderHeight] = React.useState(0);

React.useEffect(() => {
if (!headerRef.current) {
return;
}

const resizeObserver = new ResizeObserver(() => {
setHeaderHeight(headerRef.current?.offsetHeight ?? 0);
});

resizeObserver.observe(headerRef.current);
return () => {
return resizeObserver.disconnect();
};
}, []);

return (
<>
{styles.headerPosition === "fixed" && headerHeight > 0 ? (
<div style={{ minHeight: headerHeight }} />
) : null}
<div
ref={headerRef}
className={headerWrapper({ position: styles.headerPosition })}
>
<div className={headerWrapper({ position: styles.headerPosition })}>
{/* Secondary Header (Top Bar) */}
<div className="hidden md:flex">
<slots.SecondaryHeaderSlot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const SecondaryHeaderSlotWrapper: PuckComponent<SecondaryHeaderSlotProps> = ({
background={styles.backgroundColor}
className="md:flex md:justify-end md:gap-6 md:items-center"
>
<slots.LinksSlot style={{ height: "auto" }} />
<slots.LinksSlot style={{ height: "auto", width: "fit-content" }} />
{data.showLanguageDropdown && showLanguageSelector && (
<LanguageDropdown {...languageDropDownProps} />
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Migration } from "../../utils/migrate";

export const mergeStickyAndFixedHeader: Migration = {
ExpandedHeader: {
action: "updated",
propTransformation: (props) => {
if (props.styles?.headerPosition === "sticky") {
props.styles.headerPosition = "fixed";
}
return props;
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import { expandedFooterSlots } from "./0042_expanded_footer_slots.ts";
import { setDefaultCtaVariants } from "./0043_set_default_cta_variants.ts";
import { fixRootMetaFieldsMigration } from "./0044_fix_root_meta_fields.ts";

import { mergeStickyAndFixedHeader } from "./0046_merge_sticky_and_fixed_header.ts";

// To add a migration:
// Create a new file in this directory that exports a Migration
// Import it in this file and add it to this array.
Expand Down Expand Up @@ -94,4 +96,6 @@ export const migrationRegistry: MigrationRegistry = [
expandedFooterSlots,
setDefaultCtaVariants,
fixRootMetaFieldsMigration,
{},
mergeStickyAndFixedHeader,
];
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ const ProductCardComponent: PuckComponent<ProductCardProps> = (props) => {
background={styles.backgroundColor}
ref={puck.dragRef}
>
<slots.ImageSlot className="h-auto sm:min-h-[200px]" allow={[]} />
<slots.ImageSlot
style={{ height: "fit-content" }}
className="sm:min-h-[200px]"
allow={[]}
/>
<div className="p-8 gap-8 flex flex-col">
<div className="gap-4 flex flex-col flex-grow">
<slots.TitleSlot style={{ height: "auto" }} allow={[]} />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/visual-editor/src/docs/ai/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ interface VideoSectionProps {
interface ExpandedHeaderStyles {
/** The maximum width of the header */
maxWidth: PageSectionProps["maxWidth"];
/** Whether the header is "sticky" or not */
headerPosition: "sticky" | "fixed" | "scrollsWithPage";
/** Whether the header is fixed to the top of the page or not */
headerPosition: "fixed" | "scrollsWithPage";
}

interface ExpandedFooterData {
Expand Down
8 changes: 4 additions & 4 deletions packages/visual-editor/src/docs/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ The Expanded Header is a two-tiered component for websites with complex navigati

This object contains properties for customizing the appearance of both header tiers.

| Prop | Type | Description | Default |
| :---------------------- | :----------------------------------------- | :------------------------------------ | :------ |
| `styles.headerPosition` | `"sticky" \| "fixed" \| "scrollsWithPage"` | Whether the header is "sticky" or not | |
| `styles.maxWidth` | `PageSectionProps["maxWidth"]` | The maximum width of the header | |
| Prop | Type | Description | Default |
| :---------------------- | :----------------------------- | :-------------------------------------------------------- | :------ |
| `styles.headerPosition` | `"fixed" \| "scrollsWithPage"` | Whether the header is fixed to the top of the page or not | |
| `styles.maxWidth` | `PageSectionProps["maxWidth"]` | The maximum width of the header | |

---

Expand Down
6 changes: 1 addition & 5 deletions packages/visual-editor/src/vite-plugin/templates/locator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ const Locator: Template<TemplateRenderProps> = (props) => {
<VisualEditorProvider templateProps={props}>
<Render
config={locatorConfig}
data={migrate(
JSON.parse(document.__.layout),
migrationRegistry,
locatorConfig
)}
data={data}
metadata={{ streamDocument: document }}
/>
</VisualEditorProvider>
Expand Down
Loading