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