mg-library 1.0.590 → 1.0.592

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.
Files changed (3) hide show
  1. package/blocks.js +25 -11
  2. package/components.js +21 -1
  3. package/package.json +1 -1
package/blocks.js CHANGED
@@ -11,7 +11,7 @@ import { uploadFile } from '@uploadcare/upload-client';
11
11
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
12
12
 
13
13
  import './prototypes.js';
14
- import { MGText } from './components.js';
14
+ import { MGText, MGCard } from './components.js';
15
15
  import * as mgFunctionsLib from './functions.js';
16
16
  import * as mgConstantsLib from './constants.js';
17
17
  import * as mgLoginLib from './login.js';
@@ -82,14 +82,28 @@ export function MGWelcome(props) {
82
82
  data={props.notices}
83
83
  keyExtractor={item => item.idNotice.toString()}
84
84
  renderItem={({ item }) => (
85
- <Card header={cardHeader(item)} style={{ marginBottom: 10, marginHorizontal: 10 }}>
86
- {item.imageUrl != undefined &&
87
- <View style={{ flexGrow: 1, alignItems: 'center', marginBottom: 10 }}>
88
- <Image source={{ uri: item.imageUrl }} style={{ width: '70%', resizeMode: 'contain', height: undefined, aspectRatio: 1 }} />
89
- </View>
90
- }
91
- <MGText style={{ marginBottom: 10 }}>{item.content}</MGText>
92
- </Card>
85
+
86
+ /* <Card header={cardHeader(item)} style={{ marginBottom: 10, marginHorizontal: 10 }}>
87
+ {item.imageUrl != undefined &&
88
+ <View style={{ flexGrow: 1, alignItems: 'center', marginBottom: 10 }}>
89
+ <Image source={{ uri: item.imageUrl }} style={{ width: '70%', resizeMode: 'contain', height: undefined, aspectRatio: 1 }} />
90
+ </View>
91
+ }
92
+ <MGText style={{ marginBottom: 10 }}>{item.content}</MGText>
93
+ </Card> */
94
+
95
+ <MGCard header={cardHeader(item)}>
96
+ {item.imageUrl && (
97
+ <Box alignItems="center" mb={4}>
98
+ <Image
99
+ source={{ uri: item.imageUrl }}
100
+ style={{width: '70%', resizeMode: 'contain', height: undefined, aspectRatio: 1 }}
101
+ />
102
+ </Box>
103
+ )}
104
+ <MGText mb={2}>{item.content}</MGText>
105
+ </MGCard>
106
+
93
107
  )}
94
108
  ListHeaderComponent={listHeaderComponent}
95
109
  ListFooterComponent={listFooterComponent}
@@ -261,7 +275,7 @@ export function MGLogin(props) {
261
275
  render={({ field: { onChange, value } }) => (
262
276
  <NBInput
263
277
  size="lg"
264
- py={3}
278
+ py={3}
265
279
  placeholder={mgFunctionsLib.i18nString('password', props.language)}
266
280
  onChangeText={onChange}
267
281
  value={value}
@@ -279,7 +293,7 @@ export function MGLogin(props) {
279
293
  render={({ field: { onChange, value } }) => (
280
294
  <NBInput
281
295
  size="lg"
282
- py={3}
296
+ py={3}
283
297
  placeholder={mgFunctionsLib.i18nString('password', props.language)}
284
298
  onChangeText={onChange}
285
299
  value={value}
package/components.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Text } from 'native-base';
1
+ import { Text, Box } from 'native-base';
2
2
 
3
3
  const categoryMap = {
4
4
  h1: { fontSize: '4xl', fontWeight: 'bold' },
@@ -19,4 +19,24 @@ const categoryMap = {
19
19
  export function MGText({ category = 'p1', style, ...props }) {
20
20
  const styleProps = categoryMap[category] || categoryMap.p1;
21
21
  return <Text {...styleProps} {...props} style={style} />;
22
+ }
23
+
24
+ export function MGCard({ children, header = null, style = {}, ...props }) {
25
+ return (
26
+ <Box
27
+ borderWidth={1}
28
+ borderColor="coolGray.200"
29
+ borderRadius="md"
30
+ bg="white"
31
+ shadow={2}
32
+ p={4}
33
+ mb={4}
34
+ mx={2}
35
+ style={style}
36
+ {...props}
37
+ >
38
+ {header}
39
+ {children}
40
+ </Box>
41
+ );
22
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.590",
3
+ "version": "1.0.592",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {