@meduza/ui-kit-2 1.4.0 → 1.4.1

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.
@@ -423,7 +423,7 @@ const RenderPicture = ({
423
423
  }));
424
424
  };
425
425
 
426
- var styles$F = {"root":"Image-module_root__H5wAh","fullRatio":"Image-module_fullRatio__q7QPa","isStatic":"Image-module_isStatic__TmQ1V","isLoaded":"Image-module_isLoaded__keFnD","wrapper":"Image-module_wrapper__gJtbB","fullscreen":"Image-module_fullscreen__4PU9c","dark":"Image-module_dark__qjo5O"};
426
+ var styles$F = {"root":"Image-module_root__H5wAh","fullRatio":"Image-module_fullRatio__q7QPa","isStatic":"Image-module_isStatic__TmQ1V","isLoaded":"Image-module_isLoaded__keFnD","wrapper":"Image-module_wrapper__gJtbB","fullscreen":"Image-module_fullscreen__4PU9c","dark":"Image-module_dark__qjo5O","isRelated":"Image-module_isRelated__uSeSM"};
427
427
 
428
428
  const Image = ({
429
429
  alt,
@@ -2387,15 +2387,14 @@ const Spoiler = ({
2387
2387
  }))));
2388
2388
  };
2389
2389
 
2390
- var styles$6 = {"root":"RelatedRichBlock-module_root__-SEe7","wrapper":"RelatedRichBlock-module_wrapper__YkEpr","overlay":"RelatedRichBlock-module_overlay__tWuyR","overlayHeader":"RelatedRichBlock-module_overlayHeader__V3ynX","body":"RelatedRichBlock-module_body__XhS0U","isRich":"RelatedRichBlock-module_isRich__Z2kQ8","hasGradient":"RelatedRichBlock-module_hasGradient__s5Krh","picture":"RelatedRichBlock-module_picture__OmRKx","isCard":"RelatedRichBlock-module_isCard__wkMw-","cover":"RelatedRichBlock-module_cover__3gnIx","tag":"RelatedRichBlock-module_tag__c18sv","center":"RelatedRichBlock-module_center__KANd-","dark":"RelatedRichBlock-module_dark__cnk4R","light":"RelatedRichBlock-module_light__aJLn7","mobile":"RelatedRichBlock-module_mobile__N-G4U","desktop":"RelatedRichBlock-module_desktop__EaPOr"};
2390
+ var styles$6 = {"root":"RelatedRichBlock-module_root__-SEe7","content":"RelatedRichBlock-module_content__iyMrN","cover":"RelatedRichBlock-module_cover__3gnIx","body":"RelatedRichBlock-module_body__XhS0U","isCard":"RelatedRichBlock-module_isCard__wkMw-","tag":"RelatedRichBlock-module_tag__c18sv","center":"RelatedRichBlock-module_center__KANd-","mobile":"RelatedRichBlock-module_mobile__N-G4U","desktop":"RelatedRichBlock-module_desktop__EaPOr"};
2391
2391
 
2392
- /* eslint-disable react/jsx-no-target-blank */
2393
2392
  const RelatedRichBlock = ({
2394
2393
  block: {
2395
2394
  only_on: onlyOn,
2396
2395
  data: {
2397
- blocks,
2398
2396
  url,
2397
+ blocks,
2399
2398
  cover: {
2400
2399
  urls,
2401
2400
  gradients,
@@ -2407,70 +2406,38 @@ const RelatedRichBlock = ({
2407
2406
  },
2408
2407
  styleContext
2409
2408
  }) => {
2410
- const style = {};
2411
- const styleHeader = {};
2412
2409
  const cardType = `is${toCapitalize(layout)}`;
2413
- const [ref, inView] = useInView({
2414
- threshold: 0,
2415
- triggerOnce: true
2416
- });
2417
- useEffect(() => {
2418
- if (inView) {
2419
- if (onlyOn === 'mobile' && window.innerWidth <= 511 || onlyOn === 'desktop' && window.innerWidth >= 512 || !onlyOn) {
2420
- postMessage('richRelated', url, 'view');
2421
- }
2422
- }
2423
- }, [inView]);
2424
- const handleClick = () => {
2425
- postMessage('richRelated', url, 'click');
2426
- };
2427
2410
  let classNames = [[styles$6.root, true], [styles$6[cardType], !!layout && !!styles$6[cardType]], [styles$6.hasGradient, !!gradients], [styles$6[onlyOn], !!onlyOn && !!styles$6[onlyOn]]];
2428
2411
  let context = ['isInMediaBlock'];
2429
2412
  if (styleContext) {
2430
2413
  classNames = makeStyleContext(classNames, styleContext, styles$6);
2431
2414
  context = [...styleContext, 'isInMediaBlock'];
2432
2415
  }
2433
- if (gradients) {
2434
- styleHeader.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockTop');
2435
- const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
2436
- classNames = makeStyleContext(classNames, theme, styles$6);
2437
- if (onlyOn === 'desktop') {
2438
- style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
2439
- }
2440
- }
2441
2416
  return /*#__PURE__*/React.createElement(Link, {
2442
2417
  "data-testid": "related-rich-block",
2443
2418
  className: makeClassName(classNames),
2444
- to: `/${url}`,
2445
- onClick: () => handleClick(),
2446
- ref: ref
2447
- }, layout === 'rich' && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2448
- className: styles$6.overlay,
2449
- style: style
2450
- }), /*#__PURE__*/React.createElement("div", {
2451
- className: styles$6.overlayHeader,
2452
- style: styleHeader
2453
- }))), /*#__PURE__*/React.createElement("div", {
2419
+ to: `/${url}`
2420
+ }, /*#__PURE__*/React.createElement("div", {
2454
2421
  className: styles$6.tag
2455
2422
  }, /*#__PURE__*/React.createElement(Tag, {
2456
2423
  size: "small",
2457
2424
  theme: "inherit",
2458
2425
  styleContext: "richRelated"
2459
2426
  }, tag)), /*#__PURE__*/React.createElement("div", {
2460
- className: styles$6.cover
2427
+ className: styles$6.content
2461
2428
  }, /*#__PURE__*/React.createElement("div", {
2462
- className: styles$6.picture
2429
+ className: styles$6.cover
2463
2430
  }, /*#__PURE__*/React.createElement(Image, {
2464
2431
  optimized: urls,
2465
2432
  ratio: ratio,
2466
2433
  display: "narrow"
2467
- }))), /*#__PURE__*/React.createElement("div", {
2434
+ })), /*#__PURE__*/React.createElement("div", {
2468
2435
  className: styles$6.body
2469
2436
  }, blocks.map(item => (/*#__PURE__*/React.createElement(RenderBlocks, {
2470
2437
  key: item.id,
2471
2438
  block: item,
2472
2439
  styleContext: context
2473
- })))));
2440
+ }))))));
2474
2441
  };
2475
2442
 
2476
2443
  var styles$5 = {"root":"ShopRelatedBlock-module_root__eTGjC","wrapper":"ShopRelatedBlock-module_wrapper__v6yE3","overlay":"ShopRelatedBlock-module_overlay__oR67Y","overlayHeader":"ShopRelatedBlock-module_overlayHeader__YMcNw","body":"ShopRelatedBlock-module_body__W4pBN","hasGradient":"ShopRelatedBlock-module_hasGradient__50JTl","picture":"ShopRelatedBlock-module_picture__zjFL4","tag":"ShopRelatedBlock-module_tag__ixkda","center":"ShopRelatedBlock-module_center__IpBP4","title":"ShopRelatedBlock-module_title__COl93","price":"ShopRelatedBlock-module_price__5Qitu","dark":"ShopRelatedBlock-module_dark__d0QiW","light":"ShopRelatedBlock-module_light__lUDWA","mobile":"ShopRelatedBlock-module_mobile__I6Hih","desktop":"ShopRelatedBlock-module_desktop__ywKrb"};