@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.
@@ -24136,7 +24136,7 @@ var VideoProvider;
24136
24136
  VideoProvider["Vimeo"] = "Vimeo";
24137
24137
  })(VideoProvider || (VideoProvider = {}));
24138
24138
 
24139
- const VideoContainer = styled.figure`
24139
+ const VideoContainer$1 = styled.figure`
24140
24140
  display: block;
24141
24141
  padding-top: 56.25%;
24142
24142
  position: relative;
@@ -24196,7 +24196,7 @@ var Video = function (_a) {
24196
24196
  useEffect(function () {
24197
24197
  setNotServer(true);
24198
24198
  }, []);
24199
- return (React.createElement(React.Fragment, null, cookiesAccepted && notServer ? (React.createElement(VideoContainer, { "data-testid": "Video" },
24199
+ return (React.createElement(React.Fragment, null, cookiesAccepted && notServer ? (React.createElement(VideoContainer$1, { "data-testid": "Video" },
24200
24200
  React.createElement("iframe", { src: embedLink, title: description, allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen;", "data-testid": "VideoIframe" }))) : (React.createElement(VideoLink, { href: watchLink, title: description, "data-testid": "VideoLink" }, description))));
24201
24201
  };
24202
24202
 
@@ -25773,6 +25773,10 @@ const Search = styled.div`
25773
25773
  margin: ${(props) => props.theme.theme_vars.spacingSizes.medium} 0;
25774
25774
  `;
25775
25775
 
25776
+ const VideoContainer = styled.div`
25777
+ width: 100%;
25778
+ `;
25779
+
25776
25780
  const VideoBackground = styled.video`
25777
25781
  position: absolute;
25778
25782
  top: 0;
@@ -25786,19 +25790,57 @@ const VideoBackground = styled.video`
25786
25790
  }
25787
25791
  `;
25788
25792
 
25793
+ const PlayPauseButton = styled.button`
25794
+ position: absolute;
25795
+ bottom: 40px;
25796
+ right: 40px;
25797
+ background: rgba(0, 0, 0, 0.5);
25798
+ border: 1px solid white;
25799
+ color: white;
25800
+ font-size: 32px;
25801
+ border-radius: 50%;
25802
+ width: 50px;
25803
+ height: 50px;
25804
+ cursor: pointer;
25805
+ display: flex;
25806
+ align-items: center;
25807
+ justify-content: center;
25808
+ z-index: 10;
25809
+
25810
+ &:hover {
25811
+ background: rgba(0, 0, 0, 0.7);
25812
+ }
25813
+ `;
25814
+
25789
25815
  /**
25790
25816
  * Hero image banner with optional text and call to action with varying presentation of text area.
25791
25817
  * For optional use at the top of a service landing page, if set in the CMS.
25792
25818
  */
25793
25819
  var HeroImage = function (_a) {
25794
25820
  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;
25821
+ var _d = useState(true), isPlaying = _d[0], setIsPlaying = _d[1];
25822
+ var videoRef = useRef(null);
25823
+ var togglePlay = function () {
25824
+ if (videoRef.current) {
25825
+ if (isPlaying) {
25826
+ videoRef.current.pause();
25827
+ }
25828
+ else {
25829
+ videoRef.current.play();
25830
+ }
25831
+ setIsPlaying(!isPlaying);
25832
+ }
25833
+ };
25795
25834
  return (React.createElement(React.Fragment, null,
25796
25835
  React.createElement(LazyImage, { src: imageLarge, placeholder: imageSmall, visibilitySensorProps: {
25797
25836
  partialVisibility: true,
25798
25837
  } }, function (src) { return (React.createElement(Container$u, { "$image": src, "$backgroundBox": backgroundBox, "data-testid": "HeroImage" },
25799
- heroVideoUrl && (React.createElement(VideoBackground, { autoPlay: true, loop: true, muted: true },
25800
- React.createElement("source", { src: heroVideoUrl, type: "video/mp4" }),
25801
- "Your browser doesn't support this video.")),
25838
+ heroVideoUrl && (React.createElement(React.Fragment, null,
25839
+ React.createElement(VideoContainer, null,
25840
+ React.createElement(VideoBackground, { ref: videoRef, autoPlay: "false", loop: true, muted: true },
25841
+ React.createElement("source", { src: heroVideoUrl, type: "video/mp4" }),
25842
+ "Your browser doesn't support this video."),
25843
+ React.createElement(PlayPauseButton, { onClick: togglePlay }, isPlaying ? '⏸' : '▶')))),
25802
25844
  React.createElement(InnerContainer, null,
25803
25845
  React.createElement(Overlay, { "$backgroundBox": backgroundBox, "data-testid": "HeroImageOverlay" },
25804
25846
  breadcrumb && (React.createElement(BreadcrumbLink, { href: breadcrumb.url, "$backgroundBox": backgroundBox }, breadcrumb.title)),