@meduza/ui-kit-2 1.4.7 → 1.4.8

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.
@@ -5557,6 +5557,34 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
5557
5557
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
5558
5558
  }
5559
5559
 
5560
+ .Cover-module_isOnImage__J296p {
5561
+ --overlayColor: var(--titleColor, #fff);
5562
+ }
5563
+
5564
+ .Cover-module_isOnImage__J296p .Cover-module_image__frrrH::after {
5565
+ position: absolute;
5566
+ top: 0;
5567
+ right: 0;
5568
+ bottom: 0;
5569
+ left: 0;
5570
+ z-index: 1;
5571
+
5572
+ background-image: var(--titleGradient, none);
5573
+
5574
+ content: '';
5575
+ }
5576
+
5577
+ .Cover-module_isOnImage__J296p .Cover-module_body__eJpUI {
5578
+ top: 0;
5579
+
5580
+ justify-content: var(--titlePosition, flex-end);
5581
+
5582
+ padding-top: 20px;
5583
+
5584
+ color: var(--titleColor, #fff);
5585
+ text-shadow: none;
5586
+ }
5587
+
5560
5588
  .Cover-module_control__WP0G3 {
5561
5589
  position: absolute;
5562
5590
  right: 49px;
package/dist/ui-kit.css CHANGED
@@ -5557,6 +5557,34 @@ ul.VersesBlock-module_root__CrgSZ:first-child {
5557
5557
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
5558
5558
  }
5559
5559
 
5560
+ .Cover-module_isOnImage__J296p {
5561
+ --overlayColor: var(--titleColor, #fff);
5562
+ }
5563
+
5564
+ .Cover-module_isOnImage__J296p .Cover-module_image__frrrH::after {
5565
+ position: absolute;
5566
+ top: 0;
5567
+ right: 0;
5568
+ bottom: 0;
5569
+ left: 0;
5570
+ z-index: 1;
5571
+
5572
+ background-image: var(--titleGradient, none);
5573
+
5574
+ content: '';
5575
+ }
5576
+
5577
+ .Cover-module_isOnImage__J296p .Cover-module_body__eJpUI {
5578
+ top: 0;
5579
+
5580
+ justify-content: var(--titlePosition, flex-end);
5581
+
5582
+ padding-top: 20px;
5583
+
5584
+ color: var(--titleColor, #fff);
5585
+ text-shadow: none;
5586
+ }
5587
+
5560
5588
  .Cover-module_control__WP0G3 {
5561
5589
  position: absolute;
5562
5590
  right: 49px;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.7",
2
+ "version": "1.4.8",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -51,6 +51,34 @@
51
51
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
52
52
  }
53
53
 
54
+ .isOnImage {
55
+ --overlayColor: var(--titleColor, #fff);
56
+ }
57
+
58
+ .isOnImage .image::after {
59
+ position: absolute;
60
+ top: 0;
61
+ right: 0;
62
+ bottom: 0;
63
+ left: 0;
64
+ z-index: 1;
65
+
66
+ background-image: var(--titleGradient, none);
67
+
68
+ content: '';
69
+ }
70
+
71
+ .isOnImage .body {
72
+ top: 0;
73
+
74
+ justify-content: var(--titlePosition, flex-end);
75
+
76
+ padding-top: 20px;
77
+
78
+ color: var(--titleColor, #fff);
79
+ text-shadow: none;
80
+ }
81
+
54
82
  .control {
55
83
  position: absolute;
56
84
  right: 49px;
@@ -23,4 +23,5 @@ export interface CoverProps {
23
23
  }
24
24
  }
25
25
  styleContext?: string[] | string
26
+ titleStyle?: Record<string, string>
26
27
  }
@@ -18,22 +18,30 @@ export const Cover: React.FC<CoverProps> = ({
18
18
  cover: { credit, caption, urls, mobile_ratio: mobileRatio, gradients, cc }
19
19
  }
20
20
  },
21
- styleContext
21
+ styleContext,
22
+ titleStyle
22
23
  }) => {
23
24
  const [isPopoverShown, setIsPopoverShown] = useState(false)
24
25
 
25
26
  const style: React.CSSProperties = {}
26
27
 
28
+ const isOnImage = !!titleStyle
29
+ const contexts = Array.isArray(styleContext)
30
+ ? styleContext
31
+ : [styleContext].filter(Boolean)
32
+ const blockStyleContext = isOnImage ? [...contexts, 'overlay'] : styleContext
33
+
27
34
  let classNames: ClassNames = [
28
35
  [styles.root, true],
29
- [styles[onlyOn], !!onlyOn && !!styles[onlyOn]]
36
+ [styles[onlyOn], !!onlyOn && !!styles[onlyOn]],
37
+ [styles.isOnImage, isOnImage]
30
38
  ]
31
39
 
32
40
  if (styleContext) {
33
41
  classNames = makeStyleContext(classNames, styleContext, styles)
34
42
  }
35
43
 
36
- if (gradients) {
44
+ if (gradients && !isOnImage) {
37
45
  const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light']
38
46
 
39
47
  classNames = makeStyleContext(classNames, theme, styles)
@@ -53,7 +61,11 @@ export const Cover: React.FC<CoverProps> = ({
53
61
  )
54
62
 
55
63
  return (
56
- <div data-testid="cover" className={makeClassName(classNames)}>
64
+ <div
65
+ data-testid="cover"
66
+ className={makeClassName(classNames)}
67
+ style={titleStyle}
68
+ >
57
69
  <div className={styles.image}>
58
70
  <Image optimized={urls} ratio={mobileRatio} display="narrow" />
59
71
  </div>
@@ -62,7 +74,7 @@ export const Cover: React.FC<CoverProps> = ({
62
74
  <RenderBlocks
63
75
  key={item.id}
64
76
  block={item}
65
- styleContext={styleContext}
77
+ styleContext={blockStyleContext}
66
78
  />
67
79
  ))}
68
80
  </div>
@@ -22,9 +22,9 @@ export const GroupedBlock: React.FC<GroupedBlockProps> = ({
22
22
 
23
23
  const normalizedBoxesWidth = block.data.map((item) => {
24
24
  const width =
25
- (item.data && item.data.width) || (item.item && item.item.data.heigh)
25
+ (item.data && item.data.width) || (item.item && item.item.data.width)
26
26
  const height =
27
- (item.data && item.data.height) || (item.item && item.item.data.heigh)
27
+ (item.data && item.data.height) || (item.item && item.item.data.height)
28
28
  return width / (height / maxHeight)
29
29
  })
30
30
 
@@ -4,7 +4,6 @@ import { MetaItem } from '../MetaItem'
4
4
  import { MetaItemLive } from '../MetaItemLive'
5
5
  import { DocumentItemsCount } from '../DocumentItemsCount'
6
6
  import { Timestamp } from '../Timestamp'
7
- import { SvgSymbol } from '../SvgSymbol'
8
7
  import { PreviewWrapper } from '../_storybook/PreviewWrapper'
9
8
 
10
9
  import styles from './Meta.stories.module.css'
package/src/types.ts CHANGED
@@ -5,13 +5,7 @@ export interface OptimizedImageItem {
5
5
  '2x_webp': string
6
6
  }
7
7
 
8
- export type CallToActions =
9
- | 'fb'
10
- | 'tw'
11
- | 'tg'
12
- | 'reaction'
13
- | 'pdf'
14
- | 'cross'
8
+ export type CallToActions = 'fb' | 'tw' | 'tg' | 'reaction' | 'pdf' | 'cross'
15
9
 
16
10
  export type LightboxImage = {
17
11
  original: string