@meduza/ui-kit-2 0.1.58 → 0.1.60

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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.58",
2
+ "version": "0.1.60",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -110,6 +110,7 @@ export const DotsOnImage: React.FC<DotsOnImageProps> = ({
110
110
  ref={ref}
111
111
  >
112
112
  <Image
113
+ fullscreen={false}
113
114
  optimized={optimized}
114
115
  width={width}
115
116
  height={height}
@@ -16,6 +16,7 @@ export interface ImageProps {
16
16
  source?: string[]
17
17
  lazy?: boolean
18
18
  ratio?: number
19
+ fullscreen?: boolean
19
20
  styleContext?: string[] | string
20
21
  }
21
22
 
@@ -18,13 +18,14 @@ export const Image: React.FC<ImageProps> = ({
18
18
  source,
19
19
  lazy,
20
20
  ratio,
21
- styleContext
21
+ styleContext,
22
+ fullscreen = true
22
23
  }) => {
23
24
  const { lightBox } = useContext(BlockContext)
24
25
  const [isLoaded, setIsLoaded] = useState(lazy ? false : true)
25
26
 
26
27
  const handleClick = (): void => {
27
- if (!lightBox || (optimized && !optimized.original)) {
28
+ if (!lightBox || !fullscreen || (optimized && !optimized.original)) {
28
29
  return
29
30
  }
30
31
 
@@ -49,7 +50,10 @@ export const Image: React.FC<ImageProps> = ({
49
50
  let classNames: ClassNames = [
50
51
  [styles.root, true],
51
52
  [styles.isLoaded, isLoaded],
52
- [styles.fullscreen, lightBox && optimized && optimized.original]
53
+ [
54
+ styles.fullscreen,
55
+ lightBox && optimized && optimized.original && fullscreen
56
+ ]
53
57
  ]
54
58
 
55
59
  if (styleContext) {
@@ -1,11 +1,12 @@
1
1
  import React from 'react'
2
+ import { CallToActions } from '../types'
2
3
  export interface MetaContainerProps {
3
4
  block: any
4
5
  styleContext: string[] | string
5
6
  isRead: boolean | undefined
6
7
  isListened: boolean | undefined
7
8
  isInBookmarks: boolean | undefined
8
- bookmarkAction?: (service: string, place: string) => void
9
+ bookmarkAction?: (service: CallToActions, place: string) => void
9
10
  lightBox?: () => void
10
11
  lang: 'ru' | 'en'
11
12
  }
@@ -1,4 +1,5 @@
1
1
  import { ImageProps } from '../Image/Image.types'
2
+ import { CallToActions, LightboxContext } from '../types'
2
3
 
3
4
  export type lightBox = {
4
5
  show: (image?: ImageProps['optimized'], alt?: ImageProps['alt']) => void
@@ -12,6 +13,6 @@ export interface RawHtmlBlockProps {
12
13
  isRead?: boolean | undefined
13
14
  isListened?: boolean | undefined
14
15
  isInBookmarks?: boolean | undefined
15
- bookmarkAction?: (service: string, place: string) => void
16
- lightBox?: lightBox | null
16
+ bookmarkAction?: (service: CallToActions, place: string) => void
17
+ lightBox?: LightboxContext | null | undefined
17
18
  }
@@ -1,17 +1,12 @@
1
- import { ImageProps } from '../Image/Image.types'
1
+ import { CallToActions, LightboxContext } from '../types'
2
2
 
3
- export type lightBox = {
4
- show: (image?: ImageProps['optimized'], alt?: ImageProps['alt']) => void
5
- hide: () => void
6
- visible: boolean
7
- }
8
3
  export interface RenderBlocksProps {
9
4
  block: any
10
5
  styleContext?: any
11
6
  isRead?: boolean
12
7
  isListened?: boolean
13
8
  isInBookmarks?: boolean
14
- bookmarkAction?: (service: string, place: string) => void
15
- lightBox?: lightBox | null
9
+ bookmarkAction?: (service: CallToActions, place: string) => void
10
+ lightBox?: LightboxContext | null | undefined
16
11
  lang?: 'ru' | 'en'
17
12
  }
package/src/types.ts CHANGED
@@ -4,3 +4,20 @@ export interface OptimizedImageItem {
4
4
  '1x_webp': string
5
5
  '2x_webp': string
6
6
  }
7
+
8
+ export type CallToActions =
9
+ | 'fb'
10
+ | 'tw'
11
+ | 'vk'
12
+ | 'ok'
13
+ | 'tg'
14
+ | 'wp'
15
+ | 'reaction'
16
+ | 'bookmark'
17
+ | 'cross'
18
+
19
+ export interface LightboxContext {
20
+ show: (image?: OptimizedImageItem, alt?: string) => void
21
+ hide: () => void
22
+ visible: boolean
23
+ }