diff --git a/assets/src/components/v2/triptych/triptych_three_pane.tsx b/assets/src/components/v2/triptych/triptych_three_pane.tsx index 744dffe07..3c15d9cf9 100644 --- a/assets/src/components/v2/triptych/triptych_three_pane.tsx +++ b/assets/src/components/v2/triptych/triptych_three_pane.tsx @@ -1,6 +1,7 @@ import React from "react"; import Widget, { WidgetData } from "Components/v2/widget"; +import { TriptychPane, getTriptychPane } from "Util/outfront"; interface Props { left_pane: WidgetData; @@ -8,21 +9,26 @@ interface Props { right_pane: WidgetData; } +const isInViewport = (pane: TriptychPane | null, slotPosition: TriptychPane) => + pane == null || pane == slotPosition; + const TriptychThreePane: React.ComponentType = ({ left_pane: leftPane, middle_pane: middlePane, right_pane: rightPane, }) => { + const pane = getTriptychPane(); + return ( <>
- + {isInViewport(pane, "left") && }
- + {isInViewport(pane, "middle") && }
- + {isInViewport(pane, "right") && }
);