documents/demo cleanup
This commit is contained in:
parent
876359db7c
commit
a82f20a7f3
4 changed files with 29 additions and 38 deletions
|
|
@ -10,7 +10,7 @@ The `ScrollerVideo` component creates interactive video experiences that respond
|
||||||
|
|
||||||
## Basic demo
|
## Basic demo
|
||||||
|
|
||||||
To use the `ScrollerVideo` component, import it and provide the video source. Set the `height` prop to any valid CSS height value such as `1200px` or `200lvh` to set the scroll height.
|
To use the `ScrollerVideo` component, import it and provide the video source. The scroll height defaults to `200lvh`, but you can adjust this to any valid CSS height value such as `1200px` or `200lvh` with the `height` prop.
|
||||||
|
|
||||||
> 💡TIP: Use `lvh` or `svh` units instead of `vh` unit for the height, as [these units](https://www.w3.org/TR/css-values-4/#large-viewport-size) are more reliable on mobile or other devices where elements such as the address bar toggle between being shown and hidden.
|
> 💡TIP: Use `lvh` or `svh` units instead of `vh` unit for the height, as [these units](https://www.w3.org/TR/css-values-4/#large-viewport-size) are more reliable on mobile or other devices where elements such as the address bar toggle between being shown and hidden.
|
||||||
|
|
||||||
|
|
@ -21,6 +21,7 @@ To use the `ScrollerVideo` component, import it and provide the video source. Se
|
||||||
import { ScrollerVideo } from '@reuters-graphics/graphics-components';
|
import { ScrollerVideo } from '@reuters-graphics/graphics-components';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- Optionally set `height` to adjust scroll height -->
|
||||||
<ScrollerVideo src="my-video.mp4" height="500lvh" />
|
<ScrollerVideo src="my-video.mp4" height="500lvh" />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -81,15 +82,11 @@ Setting `embedded` will autoplay the entire `ScrollerVideo` component like a vid
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ScrollerVideo
|
<ScrollerVideo
|
||||||
src={Goldengate}
|
src='my-video.mp4'
|
||||||
height="200lvh"
|
embedded={true}
|
||||||
trackScroll={true}
|
|
||||||
showDebugInfo
|
|
||||||
{embedded}
|
|
||||||
embeddedProps={{
|
embeddedProps={{
|
||||||
delay: 200, // Delay before autoplay starts
|
delay: 200, // Optional: Delay before autoplay starts. Defaults to 200ms.
|
||||||
threshold: 0.5, // Threshold for triggering the autoplay
|
threshold: 0.5, // Optional: Threshold for triggering the autoplay. Defaults to 0.5.
|
||||||
height: '80lvh', // Height of the embed video
|
|
||||||
duration: 5000, // Optional: Defaults to the duration of the video.
|
duration: 5000, // Optional: Defaults to the duration of the video.
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -137,17 +137,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = {
|
const args = {
|
||||||
trackScroll: true,
|
|
||||||
height: '500lvh',
|
|
||||||
showDebugInfo: true,
|
showDebugInfo: true,
|
||||||
autoplay: false,
|
|
||||||
full: true,
|
|
||||||
sticky: true,
|
|
||||||
objectFit: 'cover',
|
|
||||||
transitionSpeed: 8,
|
|
||||||
frameThreshold: 0.1,
|
|
||||||
useWebCodecs: true,
|
|
||||||
lockScroll: true,
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -168,21 +158,11 @@
|
||||||
</Story>
|
</Story>
|
||||||
|
|
||||||
<Story name="Embed version" exportName="Embed">
|
<Story name="Embed version" exportName="Embed">
|
||||||
<!-- <ScrollerVideo
|
|
||||||
embedded={true}
|
|
||||||
src={videoSrc.Goldengate}
|
|
||||||
embeddedProps={{ autoplay: true }}
|
|
||||||
/> -->
|
|
||||||
<Embedded />
|
<Embedded />
|
||||||
</Story>
|
</Story>
|
||||||
|
|
||||||
<Story name="Autoplay" {args}>
|
<Story name="Autoplay">
|
||||||
<ScrollerVideo
|
<ScrollerVideo {...args} src={videoSrc.Goldengate} autoplay={true} />
|
||||||
{...args}
|
|
||||||
src={videoSrc.Goldengate}
|
|
||||||
useWebCodecs={false}
|
|
||||||
autoplay={true}
|
|
||||||
></ScrollerVideo>
|
|
||||||
</Story>
|
</Story>
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,6 @@
|
||||||
embeddedProps?: {
|
embeddedProps?: {
|
||||||
/** When to start the playback in terms of the component's position */
|
/** When to start the playback in terms of the component's position */
|
||||||
threshold?: number;
|
threshold?: number;
|
||||||
/** Height of embedded component */
|
|
||||||
height?: string;
|
|
||||||
/** Duration of ScrollerVideo experience as a video */
|
/** Duration of ScrollerVideo experience as a video */
|
||||||
duration?: number;
|
duration?: number;
|
||||||
/** Delay before the playback */
|
/** Delay before the playback */
|
||||||
|
|
@ -66,7 +64,6 @@
|
||||||
/** Default properties for embedded videos */
|
/** Default properties for embedded videos */
|
||||||
const defaultEmbedProps = {
|
const defaultEmbedProps = {
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
height: '80lvh',
|
|
||||||
delay: 200,
|
delay: 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -144,6 +141,7 @@
|
||||||
...restProps,
|
...restProps,
|
||||||
trackScroll: embedded ? false : restProps.trackScroll, // trackScroll disabled for embedded version
|
trackScroll: embedded ? false : restProps.trackScroll, // trackScroll disabled for embedded version
|
||||||
autoplay: embedded ? false : restProps.autoplay, // autoplay disabled for embedded version
|
autoplay: embedded ? false : restProps.autoplay, // autoplay disabled for embedded version
|
||||||
|
useWebCodecs: restProps.autoplay ? false : restProps.useWebCodecs, // useWebCodecs disabled for autoplay
|
||||||
});
|
});
|
||||||
|
|
||||||
// if embedded prop is set,
|
// if embedded prop is set,
|
||||||
|
|
|
||||||
|
|
@ -52,16 +52,16 @@
|
||||||
<BodyText text={dummyText} />
|
<BodyText text={dummyText} />
|
||||||
<BodyText text={dummyText} />
|
<BodyText text={dummyText} />
|
||||||
<BodyText text={dummyText} />
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
|
||||||
<ScrollerVideo
|
<ScrollerVideo
|
||||||
src={Goldengate}
|
src={Goldengate}
|
||||||
height="200lvh"
|
class="embedded-demo"
|
||||||
trackScroll={true}
|
showDebugInfo={true}
|
||||||
showDebugInfo
|
|
||||||
embedded={true}
|
embedded={true}
|
||||||
embeddedProps={{
|
embeddedProps={{
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
height: '100lvh',
|
|
||||||
duration: 12000,
|
duration: 12000,
|
||||||
delay: 200,
|
delay: 200,
|
||||||
}}
|
}}
|
||||||
|
|
@ -78,3 +78,19 @@
|
||||||
{/each}
|
{/each}
|
||||||
</ScrollerVideo>
|
</ScrollerVideo>
|
||||||
<BodyText text={dummyText} />
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
<BodyText text={dummyText} />
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
:global {
|
||||||
|
.embedded-demo .foreground-text {
|
||||||
|
h4,
|
||||||
|
p {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue