Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8f0b468
events section
benlife5 Oct 14, 2025
a03a906
docs: auto-generate component documentation
github-actions[bot] Oct 14, 2025
228e167
Update component screenshots for visual-editor
github-actions[bot] Oct 14, 2025
35e33b5
comments
benlife5 Oct 15, 2025
10c7bf1
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
d9ef288
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
f5b23ac
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
60191cf
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
aa6c22e
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
8780520
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
9987e59
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
ed5216e
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
f4d64b5
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
aab9cf0
Update component screenshots for visual-editor
github-actions[bot] Oct 15, 2025
209920f
increase promo threshold
benlife5 Oct 15, 2025
12552d4
misc-fixes
benlife5 Oct 15, 2025
f667966
misc fixes 2
benlife5 Oct 15, 2025
c4a5736
Merge branch 'fall-2025-slot-ify-components' into misc-fixes
benlife5 Oct 15, 2025
1cb7600
revert small unnecessary change
benlife5 Oct 15, 2025
47bc64e
revert change intended for cta pr
benlife5 Oct 15, 2025
d94c123
tsdoc
benlife5 Oct 15, 2025
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
11 changes: 9 additions & 2 deletions packages/visual-editor/src/components/atoms/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ export type ImgSizesByBreakpoint = {
/**
* Creates an img sizes attribute based on the default Tailwind breakpoints.
* Replaces `maxWidth` with the current page section max width from the theme.
* Replaces `width` with the width parameter.
* @param sizes - the width of the image at different breakpoints
* @param width - the current width prop of the image
* @returns a string for the sizes attribute of an img tag
*/
export const imgSizesHelper = (sizes: ImgSizesByBreakpoint): string => {
export const imgSizesHelper = (
sizes: ImgSizesByBreakpoint,
width?: string
): string => {
const streamDocument = useDocument();

let maxWidth = undefined;
Expand Down Expand Up @@ -145,7 +150,9 @@ export const imgSizesHelper = (sizes: ImgSizesByBreakpoint): string => {
const updatedBreakpointSizes = Object.fromEntries(
Object.entries(sizes).map(([key, value]) => [
key,
value.replace("maxWidth", maxWidth || "1440px"),
value
.replace("maxWidth", maxWidth || "1440px")
.replace("width", width || 640 + "px"),
])
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ const ImageWrapperComponent: PuckComponent<ImageWrapperProps> = (props) => {
className,
puck,
sizes = {
base: styles.width ? `min(100vw, ${styles.width}px)` : "100vw",
base: styles.width ? `min(100vw, width)` : "100vw",
md: styles.width
? `min(${styles.width}px, calc((maxWidth - 32px) / 2))`
? `min(width, calc((maxWidth - 32px) / 2))`
: "maxWidth / 2",
},
hideWidthProp,
Expand All @@ -96,7 +96,7 @@ const ImageWrapperComponent: PuckComponent<ImageWrapperProps> = (props) => {
return puck.isEditing ? <div className="h-[200px] w-full" /> : <></>;
}

const transformedSizes = imgSizesHelper(sizes);
const transformedSizes = imgSizesHelper(sizes, `${styles.width}px`);

return (
<EntityField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export const promoSectionSlots: Migration = {
},
}
: undefined,
sizes: {
base: "calc(100vw - 32px)",
md: "min(width, 450px)",
lg: "width",
},
} satisfies ImageWrapperProps,
},
],
Expand Down Expand Up @@ -182,6 +187,7 @@ export const promoSectionSlots: Migration = {
},
}
: undefined,
eventName: "cta",
} satisfies CTAWrapperProps,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const heroSectionSlots: Migration = {
constantValueOverride.primaryCta ?? false,
},
},
eventName: "primaryCta",
styles: { variant: primaryCTA },
},
},
Expand All @@ -164,6 +165,7 @@ export const heroSectionSlots: Migration = {
constantValueOverride.secondaryCta ?? false,
},
},
eventName: "secondaryCta",
styles: { variant: secondaryCTA },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const defaultEventCardSlotData = (id?: string, index?: number) => ({
{
type: "ImageSlot",
props: {
...(id && { id: `${id}-image` }),
data: {
image: {
field: "",
Expand All @@ -65,6 +66,7 @@ export const defaultEventCardSlotData = (id?: string, index?: number) => ({
{
type: "HeadingTextSlot",
props: {
...(id && { id: `${id}-title` }),
data: {
text: {
field: "",
Expand All @@ -86,6 +88,7 @@ export const defaultEventCardSlotData = (id?: string, index?: number) => ({
{
type: "Timestamp",
props: {
...(id && { id: `${id}-timestamp` }),
data: {
date: {
field: "",
Expand All @@ -109,6 +112,7 @@ export const defaultEventCardSlotData = (id?: string, index?: number) => ({
{
type: "BodyTextSlot",
props: {
...(id && { id: `${id}-description` }),
data: {
text: {
field: "",
Expand All @@ -134,6 +138,7 @@ export const defaultEventCardSlotData = (id?: string, index?: number) => ({
{
type: "CTASlot",
props: {
...(id && { id: `${id}-cta` }),
data: {
entityField: {
field: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ export const HeroSection: ComponentConfig<{ props: HeroSectionProps }> = {
},
},
},
eventName: "primaryCta",
styles: {
variant: "primary",
},
Expand Down Expand Up @@ -469,6 +470,7 @@ export const HeroSection: ComponentConfig<{ props: HeroSectionProps }> = {
styles: {
variant: "secondary",
},
eventName: "secondaryCta",
} satisfies CTAWrapperProps,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const defaultProductCardSlotData = (id?: string, index?: number) => {
{
type: "ImageSlot",
props: {
...(id && { id: `${id}-image` }),
data: {
image: {
field: "",
Expand All @@ -61,6 +62,7 @@ export const defaultProductCardSlotData = (id?: string, index?: number) => {
{
type: "HeadingTextSlot",
props: {
...(id && { id: `${id}-title` }),
data: {
text: {
field: "",
Expand All @@ -82,6 +84,7 @@ export const defaultProductCardSlotData = (id?: string, index?: number) => {
{
type: "BodyTextSlot",
props: {
...(id && { id: `${id}-category` }),
data: {
text: {
field: "",
Expand All @@ -102,6 +105,7 @@ export const defaultProductCardSlotData = (id?: string, index?: number) => {
{
type: "BodyTextSlot",
props: {
...(id && { id: `${id}-description` }),
data: {
text: {
field: "",
Expand All @@ -124,6 +128,7 @@ export const defaultProductCardSlotData = (id?: string, index?: number) => {
{
type: "CTASlot",
props: {
...(id && { id: `${id}-cta` }),
data: {
entityField: {
field: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PuckComponent,
setDeep,
Slot,
SlotComponent,
} from "@measured/puck";
import {
PromoSectionType,
Expand Down Expand Up @@ -187,8 +188,8 @@ const PromoMedia = ({
className: string;
data: PromoData;
slots: {
VideoSlot: React.ElementType;
ImageSlot: React.ElementType;
VideoSlot: SlotComponent;
ImageSlot: SlotComponent;
};
}) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -334,6 +335,11 @@ export const PromoSection: ComponentConfig<{ props: PromoSectionProps }> = {
aspectRatio: 1.78,
width: 640,
},
sizes: {
base: "calc(100vw - 32px)",
md: "min(width, 450px)",
lg: "width",
},
className:
"max-w-full sm:max-w-initial md:max-w-[450px] lg:max-w-none rounded-image-borderRadius w-full",
} satisfies ImageWrapperProps,
Expand All @@ -355,6 +361,7 @@ export const PromoSection: ComponentConfig<{ props: PromoSectionProps }> = {
},
},
styles: { variant: "primary" },
eventName: "cta",
} satisfies CTAWrapperProps,
},
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from "react";
import { createUsePuck, Data, useGetPuck, type History } from "@measured/puck";
import {
createUsePuck,
Data,
resolveAllData,
useGetPuck,
type History,
} from "@measured/puck";
import { RotateCcw, RotateCw } from "lucide-react";
import { useEffect } from "react";
import { Separator } from "@radix-ui/react-separator";
Expand All @@ -19,6 +25,7 @@ import {
usePlatformTranslation,
pt,
} from "../../../utils/i18n/platform.ts";
import { useDocument } from "../../../hooks/useDocument.tsx";

const usePuck = createUsePuck();

Expand Down Expand Up @@ -51,6 +58,7 @@ export const LayoutHeader = (props: LayoutHeaderProps) => {
React.useState<boolean>(false);
const { i18n } = usePlatformTranslation();
const getPuck = useGetPuck();
const streamDocument = useDocument();
const histories = usePuck((s) => s.history.histories);
const index = usePuck((s) => s.history.index);
const hasFuture = usePuck((s) => s.history.hasFuture);
Expand All @@ -62,6 +70,19 @@ export const LayoutHeader = (props: LayoutHeaderProps) => {

useEffect(translatePuckSidebars, [i18n.language]);

useEffect(() => {
// Resolve all data and slots when the document changes
const resolveData = async () => {
const { appState, config, dispatch } = getPuck();
const resolvedData = await resolveAllData(appState.data, config, {
streamDocument,
});
dispatch({ type: "setData", data: resolvedData });
};

resolveData();
}, [streamDocument.id]);

const buttonText = (() => {
if (templateMetadata.assignment === "ALL") {
// TODO: translation concatenation
Expand Down