@nnc-digital/nnc-design-system 1.0.0-alpha19 → 1.0.0-alpha20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -24149,7 +24149,7 @@ var VideoProvider;
24149
24149
  VideoProvider["Vimeo"] = "Vimeo";
24150
24150
  })(VideoProvider || (VideoProvider = {}));
24151
24151
 
24152
- const VideoContainer = styled__default.default.figure`
24152
+ const VideoContainer$1 = styled__default.default.figure`
24153
24153
  display: block;
24154
24154
  padding-top: 56.25%;
24155
24155
  position: relative;
@@ -24209,7 +24209,7 @@ var Video = function (_a) {
24209
24209
  React.useEffect(function () {
24210
24210
  setNotServer(true);
24211
24211
  }, []);
24212
- return (React__default.default.createElement(React__default.default.Fragment, null, cookiesAccepted && notServer ? (React__default.default.createElement(VideoContainer, { "data-testid": "Video" },
24212
+ return (React__default.default.createElement(React__default.default.Fragment, null, cookiesAccepted && notServer ? (React__default.default.createElement(VideoContainer$1, { "data-testid": "Video" },
24213
24213
  React__default.default.createElement("iframe", { src: embedLink, title: description, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen;", "data-testid": "VideoIframe" }))) : (React__default.default.createElement(VideoLink, { href: watchLink, title: description, "data-testid": "VideoLink" }, description))));
24214
24214
  };
24215
24215
 
@@ -25786,6 +25786,10 @@ const Search = styled__default.default.div`
25786
25786
  margin: ${(props) => props.theme.theme_vars.spacingSizes.medium} 0;
25787
25787
  `;
25788
25788
 
25789
+ const VideoContainer = styled__default.default.div`
25790
+ width: 100%;
25791
+ `;
25792
+
25789
25793
  const VideoBackground = styled__default.default.video`
25790
25794
  position: absolute;
25791
25795
  top: 0;
@@ -25799,19 +25803,57 @@ const VideoBackground = styled__default.default.video`
25799
25803
  }
25800
25804
  `;
25801
25805
 
25806
+ const PlayPauseButton = styled__default.default.button`
25807
+ position: absolute;
25808
+ bottom: 40px;
25809
+ right: 40px;
25810
+ background: rgba(0, 0, 0, 0.5);
25811
+ border: 1px solid white;
25812
+ color: white;
25813
+ font-size: 32px;
25814
+ border-radius: 50%;
25815
+ width: 50px;
25816
+ height: 50px;
25817
+ cursor: pointer;
25818
+ display: flex;
25819
+ align-items: center;
25820
+ justify-content: center;
25821
+ z-index: 10;
25822
+
25823
+ &:hover {
25824
+ background: rgba(0, 0, 0, 0.7);
25825
+ }
25826
+ `;
25827
+
25802
25828
  /**
25803
25829
  * Hero image banner with optional text and call to action with varying presentation of text area.
25804
25830
  * For optional use at the top of a service landing page, if set in the CMS.
25805
25831
  */
25806
25832
  var HeroImage = function (_a) {
25807
25833
  var headline = _a.headline, content = _a.content, callToActionText = _a.callToActionText, callToActionURL = _a.callToActionURL, _b = _a.callToActionIsPrimary, callToActionIsPrimary = _b === void 0 ? true : _b, _c = _a.backgroundBox, backgroundBox = _c === void 0 ? true : _c, imageLarge = _a.imageLarge, imageSmall = _a.imageSmall, imageAltText = _a.imageAltText, heroVideoUrl = _a.heroVideoUrl, breadcrumb = _a.breadcrumb, customSearch = _a.customSearch;
25834
+ var _d = React.useState(true), isPlaying = _d[0], setIsPlaying = _d[1];
25835
+ var videoRef = React.useRef(null);
25836
+ var togglePlay = function () {
25837
+ if (videoRef.current) {
25838
+ if (isPlaying) {
25839
+ videoRef.current.pause();
25840
+ }
25841
+ else {
25842
+ videoRef.current.play();
25843
+ }
25844
+ setIsPlaying(!isPlaying);
25845
+ }
25846
+ };
25808
25847
  return (React__default.default.createElement(React__default.default.Fragment, null,
25809
25848
  React__default.default.createElement(LazyImage, { src: imageLarge, placeholder: imageSmall, visibilitySensorProps: {
25810
25849
  partialVisibility: true,
25811
25850
  } }, function (src) { return (React__default.default.createElement(Container$u, { "$image": src, "$backgroundBox": backgroundBox, "data-testid": "HeroImage" },
25812
- heroVideoUrl && (React__default.default.createElement(VideoBackground, { autoPlay: true, loop: true, muted: true },
25813
- React__default.default.createElement("source", { src: heroVideoUrl, type: "video/mp4" }),
25814
- "Your browser doesn't support this video.")),
25851
+ heroVideoUrl && (React__default.default.createElement(React__default.default.Fragment, null,
25852
+ React__default.default.createElement(VideoContainer, null,
25853
+ React__default.default.createElement(VideoBackground, { ref: videoRef, autoPlay: "false", loop: true, muted: true },
25854
+ React__default.default.createElement("source", { src: heroVideoUrl, type: "video/mp4" }),
25855
+ "Your browser doesn't support this video."),
25856
+ React__default.default.createElement(PlayPauseButton, { onClick: togglePlay }, isPlaying ? '⏸' : '▶')))),
25815
25857
  React__default.default.createElement(InnerContainer, null,
25816
25858
  React__default.default.createElement(Overlay, { "$backgroundBox": backgroundBox, "data-testid": "HeroImageOverlay" },
25817
25859
  breadcrumb && (React__default.default.createElement(BreadcrumbLink, { href: breadcrumb.url, "$backgroundBox": backgroundBox }, breadcrumb.title)),