@meduza/ui-kit-2 0.1.94 → 0.1.97

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.
@@ -13,4 +13,5 @@ export interface RawHtmlBlockProps {
13
13
  isInBookmarks?: boolean | undefined;
14
14
  bookmarkAction?: (service: CallToActions, place: string) => void;
15
15
  lightBox?: LightboxContext | null | undefined;
16
+ lang: 'ru' | 'en';
16
17
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.FC<import("./ShopRelatedBlock.types").ShopRelatedBlockProps>;
5
+ parameters: {
6
+ themeWrapperSideBySide: boolean;
7
+ };
8
+ };
9
+ export default _default;
10
+ export declare const Default: React.FC;
@@ -0,0 +1,4 @@
1
+ export interface ShopRelatedBlockProps {
2
+ block?: any;
3
+ styleContext?: any;
4
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ShopRelatedBlockProps } from './ShopRelatedBlock.types';
3
+ export declare const ShopRelatedBlock: React.FC<ShopRelatedBlockProps>;
package/dist/index.d.ts CHANGED
@@ -40,3 +40,4 @@ export * from './Footnote';
40
40
  export * from './RelatedRichBlock';
41
41
  export * from './SensitiveBlock';
42
42
  export * from './DonatesTeaser';
43
+ export * from './ShopRelatedBlock';
@@ -2186,7 +2186,7 @@ var RenderBlocks = function RenderBlocks(_ref) {
2186
2186
  styleContext: styleContext
2187
2187
  });
2188
2188
 
2189
- case 'dotanes':
2189
+ case 'donation':
2190
2190
  return React__default.createElement(DonatesTeaser, {
2191
2191
  styleContext: styleContext,
2192
2192
  lang: lang
@@ -2524,7 +2524,8 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2524
2524
  isListened = _ref.isListened,
2525
2525
  isInBookmarks = _ref.isInBookmarks,
2526
2526
  bookmarkAction = _ref.bookmarkAction,
2527
- lightBox = _ref.lightBox;
2527
+ lightBox = _ref.lightBox,
2528
+ lang = _ref.lang;
2528
2529
  var context = {
2529
2530
  lightBox: lightBox || null
2530
2531
  };
@@ -2582,7 +2583,8 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2582
2583
  isRead: isRead,
2583
2584
  isListened: isListened,
2584
2585
  isInBookmarks: isInBookmarks,
2585
- bookmarkAction: bookmarkAction
2586
+ bookmarkAction: bookmarkAction,
2587
+ lang: lang
2586
2588
  }));
2587
2589
  }
2588
2590
  }
@@ -2615,6 +2617,99 @@ var ToolbarButton = function ToolbarButton(_ref) {
2615
2617
  }, children)));
2616
2618
  };
2617
2619
 
2620
+ var styles$D = {"root":"ShopRelatedBlock-module_root__x4vdk","wrapper":"ShopRelatedBlock-module_wrapper__3jQp9","overlay":"ShopRelatedBlock-module_overlay__15S5a","overlayHeader":"ShopRelatedBlock-module_overlayHeader__2IXK-","body":"ShopRelatedBlock-module_body__3ipYj","hasGradient":"ShopRelatedBlock-module_hasGradient__1pghj","picture":"ShopRelatedBlock-module_picture__1bu9H","tag":"ShopRelatedBlock-module_tag__2vTKm","center":"ShopRelatedBlock-module_center__2H85-","title":"ShopRelatedBlock-module_title__1ZIW0","price":"ShopRelatedBlock-module_price__2cVXM","dark":"ShopRelatedBlock-module_dark__3Gfbc","light":"ShopRelatedBlock-module_light__1y8Qy","mobile":"ShopRelatedBlock-module_mobile__AleU0","desktop":"ShopRelatedBlock-module_desktop__2--zA"};
2621
+
2622
+ /* eslint-disable react/jsx-no-target-blank */
2623
+ var ShopRelatedBlock = function ShopRelatedBlock(_ref) {
2624
+ var _ref$block = _ref.block,
2625
+ onlyOn = _ref$block.only_on,
2626
+ _ref$block$data = _ref$block.data,
2627
+ url = _ref$block$data.url,
2628
+ _ref$block$data$cover = _ref$block$data.cover,
2629
+ urls = _ref$block$data$cover.urls,
2630
+ gradients = _ref$block$data$cover.gradients,
2631
+ tag = _ref$block$data$cover.tag,
2632
+ layout = _ref$block$data$cover.layout,
2633
+ ratio = _ref$block$data$cover.ratio,
2634
+ firstTitle = _ref$block$data$cover.first_title,
2635
+ secondTitle = _ref$block$data$cover.second_title,
2636
+ styleContext = _ref.styleContext;
2637
+ var style = {};
2638
+ var styleHeader = {};
2639
+
2640
+ var _useInView = reactIntersectionObserver.useInView({
2641
+ threshold: 0,
2642
+ triggerOnce: true
2643
+ }),
2644
+ ref = _useInView[0],
2645
+ inView = _useInView[1];
2646
+
2647
+ React.useEffect(function () {
2648
+ if (inView) {
2649
+ if (onlyOn === 'mobile' && window.innerWidth <= 511 || onlyOn === 'desktop' && window.innerWidth >= 512 || !onlyOn) {
2650
+ postMessage('richRelated', url, 'view');
2651
+ }
2652
+ }
2653
+ }, [inView]);
2654
+
2655
+ var handleClick = function handleClick() {
2656
+ postMessage('richRelated', url, 'click');
2657
+ };
2658
+
2659
+ var classNames = [[styles$D.root, true], [styles$D.hasGradient, !!gradients], [styles$D[onlyOn], !!onlyOn && !!styles$D[onlyOn]]];
2660
+
2661
+ if (styleContext) {
2662
+ classNames = makeStyleContext(classNames, styleContext, styles$D);
2663
+ }
2664
+
2665
+ if (gradients) {
2666
+ styleHeader.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockTop');
2667
+ var theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
2668
+ classNames = makeStyleContext(classNames, theme, styles$D);
2669
+
2670
+ if (onlyOn === 'desktop') {
2671
+ style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
2672
+ }
2673
+ }
2674
+
2675
+ return React__default.createElement("a", {
2676
+ "data-testid": "related-rich-block",
2677
+ className: makeClassName(classNames),
2678
+ href: url,
2679
+ target: "_blank",
2680
+ onClick: function onClick() {
2681
+ return handleClick();
2682
+ },
2683
+ ref: ref
2684
+ }, layout === 'rich' && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
2685
+ className: styles$D.overlay,
2686
+ style: style
2687
+ }), React__default.createElement("div", {
2688
+ className: styles$D.overlayHeader,
2689
+ style: styleHeader
2690
+ })), React__default.createElement("div", {
2691
+ className: styles$D.tag
2692
+ }, React__default.createElement(Tag, {
2693
+ size: "small",
2694
+ theme: "inherit",
2695
+ styleContext: "richRelated"
2696
+ }, tag)), React__default.createElement("div", {
2697
+ className: styles$D.cover
2698
+ }, React__default.createElement("div", {
2699
+ className: styles$D.picture
2700
+ }, React__default.createElement(Image, {
2701
+ optimized: urls,
2702
+ ratio: ratio,
2703
+ display: "narrow"
2704
+ }))), React__default.createElement("div", {
2705
+ className: styles$D.body
2706
+ }, React__default.createElement("h2", {
2707
+ className: styles$D.title
2708
+ }, firstTitle, React__default.createElement("span", {
2709
+ className: styles$D.price
2710
+ }, secondTitle))));
2711
+ };
2712
+
2618
2713
  exports.BookmarkButton = BookmarkButton;
2619
2714
  exports.Button = Button;
2620
2715
  exports.CardTitle = CardTitle;
@@ -2649,6 +2744,7 @@ exports.RenderBlocks = RenderBlocks;
2649
2744
  exports.RichTitle = RichTitle;
2650
2745
  exports.Secondary = Secondary;
2651
2746
  exports.SensitiveBlock = SensitiveBlock;
2747
+ exports.ShopRelatedBlock = ShopRelatedBlock;
2652
2748
  exports.SimpleBlock = SimpleBlock;
2653
2749
  exports.SimpleTitle = SimpleTitle;
2654
2750
  exports.SourceBlock = SourceBlock;