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

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,18 @@ 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
+ position: absolute;
25791
+ top: 0;
25792
+ left: 0;
25793
+ width: 100%;
25794
+ height: 575px;
25795
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.l}) {
25796
+ height: 540px;
25797
+ }
25798
+ `;
25799
+
25800
+
25789
25801
  const VideoBackground = styled__default.default.video`
25790
25802
  position: absolute;
25791
25803
  top: 0;
@@ -25799,19 +25811,57 @@ const VideoBackground = styled__default.default.video`
25799
25811
  }
25800
25812
  `;
25801
25813
 
25814
+ const PlayPauseButton = styled__default.default.button`
25815
+ position: absolute;
25816
+ bottom: 40px;
25817
+ right: 40px;
25818
+ background: rgba(0, 0, 0, 0.5);
25819
+ border: 1px solid white;
25820
+ color: white;
25821
+ font-size: 32px;
25822
+ border-radius: 50%;
25823
+ width: 50px;
25824
+ height: 50px;
25825
+ cursor: pointer;
25826
+ display: flex;
25827
+ align-items: center;
25828
+ justify-content: center;
25829
+ z-index: 10;
25830
+
25831
+ &:hover {
25832
+ background: rgba(0, 0, 0, 0.7);
25833
+ }
25834
+ `;
25835
+
25802
25836
  /**
25803
25837
  * Hero image banner with optional text and call to action with varying presentation of text area.
25804
25838
  * For optional use at the top of a service landing page, if set in the CMS.
25805
25839
  */
25806
25840
  var HeroImage = function (_a) {
25807
25841
  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;
25842
+ var _d = React.useState(true), isPlaying = _d[0], setIsPlaying = _d[1];
25843
+ var videoRef = React.useRef(null);
25844
+ var togglePlay = function () {
25845
+ if (videoRef.current) {
25846
+ if (isPlaying) {
25847
+ videoRef.current.pause();
25848
+ }
25849
+ else {
25850
+ videoRef.current.play();
25851
+ }
25852
+ setIsPlaying(!isPlaying);
25853
+ }
25854
+ };
25808
25855
  return (React__default.default.createElement(React__default.default.Fragment, null,
25809
25856
  React__default.default.createElement(LazyImage, { src: imageLarge, placeholder: imageSmall, visibilitySensorProps: {
25810
25857
  partialVisibility: true,
25811
25858
  } }, 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.")),
25859
+ heroVideoUrl && (React__default.default.createElement(React__default.default.Fragment, null,
25860
+ React__default.default.createElement(VideoContainer, null,
25861
+ React__default.default.createElement(VideoBackground, { ref: videoRef, autoPlay: true, loop: true, muted: true },
25862
+ React__default.default.createElement("source", { src: heroVideoUrl, type: "video/mp4" }),
25863
+ "Your browser doesn't support this video."),
25864
+ React__default.default.createElement(PlayPauseButton, { onClick: togglePlay }, isPlaying ? '⏸' : '▶')))),
25815
25865
  React__default.default.createElement(InnerContainer, null,
25816
25866
  React__default.default.createElement(Overlay, { "$backgroundBox": backgroundBox, "data-testid": "HeroImageOverlay" },
25817
25867
  breadcrumb && (React__default.default.createElement(BreadcrumbLink, { href: breadcrumb.url, "$backgroundBox": backgroundBox }, breadcrumb.title)),