This commit is contained in:
Sudev Kiyada 2025-08-07 18:58:45 +05:30
parent 8e0a210dd6
commit 0e2d32a9be
Failed to extract signature

View file

@ -282,30 +282,24 @@ endTime: 0.3 # When to stop showing the headline
<!-- Loop through content blocks... --> <!-- Loop through content blocks... -->
{#each content.blocks as block} {#each content.blocks as block}
{#if block.type == 'scroller-video'} {#if block.type == 'scroller-video'}
<!-- ScrollVideo snippet to render responsive videos -->
{#snippet ScrollVideo(height: string, src: string)}
<ScrollerVideo id={block.id} {height} {src}>
<!-- Headline component as foreground -->
<ScrollerVideoForeground
startTime={parseFloat(content.startTime)}
endTime={parseFloat(content.endTime)}
>
<Headline
hed={content.hed}
authors={content.authors}
publishTime={new Date(content.publishTime).toISOString()}
/>
</ScrollerVideoForeground>
<!-- ScrollVideo snippet to render responsive videos --> <!-- Loop through block.foregrounds to render each foreground component -->
{#snippet ScrollVideo(height: string, src: string)} {#each block.foregrounds as foreground}
<ScrollerVideo
id={block.id}
{height}
{src}
>
<!-- Headline component as foreground -->
<ScrollerVideoForeground
startTime={parseFloat(content.startTime)}
endTime={parseFloat(content.endTime)}
>
<Headline
hed={content.hed}
authors={content.authors}
publishTime={new Date(content.publishTime).toISOString()}
/>
</ScrollerVideoForeground>
<!-- Loop through block.foregrounds to render each foreground component -->
{#each block.foregrounds as foreground}
<ScrollerVideoForeground <ScrollerVideoForeground
startTime={parseFloat(foreground.startTime)} startTime={parseFloat(foreground.startTime)}
endTime={parseFloat(foreground.endTime)} endTime={parseFloat(foreground.endTime)}
@ -314,17 +308,18 @@ endTime: 0.3 # When to stop showing the headline
foreground.foreground as keyof typeof aiChartsForeground foreground.foreground as keyof typeof aiChartsForeground
]} ]}
/> />
{/each} {/each}
</ScrollerVideo> </ScrollerVideo>
{/snippet} {/snippet}
<!-- Render the ScrollVideo snippet for different screen sizes --> <!-- Render the ScrollVideo snippet for different screen sizes -->
{#if width < 600} {#if width < 600}
{@render ScrollVideo({block.height}, `${assets}/${block.srcSm}`)} {@render ScrollVideo(block.height, `${assets}/${block.srcSm}`)}
{:else if width < 1200} {:else if width < 1200}
{@render ScrollVideo({block.height}, `${assets}/${block.srcMd}`)} {@render ScrollVideo(block.height, `${assets}/${block.srcMd}`)}
{:else} {:else}
{@render ScrollVideo({block.height}, `${assets}/${block.srcLg}`)} {@render ScrollVideo(block.height, `${assets}/${block.srcLg}`)}
{/if}
{/if} {/if}
{/each} {/each}
``` ```