@vixoniccom/news-internal 0.4.21-dev.18 → 0.4.21-dev.19
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/CHANGELOG.md +7 -0
- package/build/main.js +1 -1
- package/build.zip +0 -0
- package/package.json +1 -1
- package/src/components/App.tsx +13 -38
package/build.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/components/App.tsx
CHANGED
|
@@ -10,6 +10,16 @@ export type Props = {
|
|
|
10
10
|
|
|
11
11
|
export const App: React.FunctionComponent<Props> = ({ data }) => {
|
|
12
12
|
const [news, setNews] = useState<NewsItem[]>([])
|
|
13
|
+
|
|
14
|
+
const getPrefixBySize = (n: any, size: string, prefix: string): string => {
|
|
15
|
+
const prefixMap: { [key: string]: string } = {
|
|
16
|
+
'short': n[`${prefix}Short`],
|
|
17
|
+
'medium': n[`${prefix}Medium`],
|
|
18
|
+
'large': n[`${prefix}Large`],
|
|
19
|
+
'extra-large': n[`${prefix}ExtraLarge`]
|
|
20
|
+
}
|
|
21
|
+
return prefixMap[size] || n[`${prefix}Medium`] || ''
|
|
22
|
+
}
|
|
13
23
|
|
|
14
24
|
const parseNews = (data?: VixonicData): NewsItem[] => {
|
|
15
25
|
if (!data) return []
|
|
@@ -20,44 +30,9 @@ export const App: React.FunctionComponent<Props> = ({ data }) => {
|
|
|
20
30
|
const qrUrl = n.qrCodeUrl
|
|
21
31
|
if (image?.filename) parsedImage = `${data.downloadsPath}/${image.filename}`
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
case 'short':
|
|
27
|
-
title = n.titleShort || ''
|
|
28
|
-
break
|
|
29
|
-
case 'medium':
|
|
30
|
-
title = n.titleMedium || ''
|
|
31
|
-
break
|
|
32
|
-
case 'large':
|
|
33
|
-
title = n.titleLarge || ''
|
|
34
|
-
break
|
|
35
|
-
case 'extra-large':
|
|
36
|
-
title = n.titleExtraLarge || ''
|
|
37
|
-
break
|
|
38
|
-
default:
|
|
39
|
-
title = n.titleMedium || ''
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Mapear description según newsSizeSelect
|
|
43
|
-
let description = ''
|
|
44
|
-
switch (newsSizeSelect) {
|
|
45
|
-
case 'short':
|
|
46
|
-
description = n.descriptionShort || ''
|
|
47
|
-
break
|
|
48
|
-
case 'medium':
|
|
49
|
-
description = n.descriptionMedium || ''
|
|
50
|
-
break
|
|
51
|
-
case 'large':
|
|
52
|
-
description = n.descriptionLarge || ''
|
|
53
|
-
break
|
|
54
|
-
case 'extra-large':
|
|
55
|
-
description = n.descriptionExtraLarge || ''
|
|
56
|
-
break
|
|
57
|
-
default:
|
|
58
|
-
description = n.descriptionMedium || ''
|
|
59
|
-
}
|
|
60
|
-
|
|
33
|
+
let title = getPrefixBySize(n, newsSizeSelect || 'medium', 'title')
|
|
34
|
+
let description = getPrefixBySize(n, newsSizeSelect || 'medium', 'description')
|
|
35
|
+
|
|
61
36
|
return {
|
|
62
37
|
...rest,
|
|
63
38
|
title,
|