@widergy/mobile-ui 1.3.2 → 1.3.3

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.3.3](https://github.com/widergy/mobile-ui/compare/v1.3.2...v1.3.3) (2024-03-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * custom components in utheader ([#269](https://github.com/widergy/mobile-ui/issues/269)) ([4400fce](https://github.com/widergy/mobile-ui/commit/4400fce3977d35080ebd766a253dba6d0da0c753))
7
+
1
8
  ## [1.3.2](https://github.com/widergy/mobile-ui/compare/v1.3.1...v1.3.2) (2024-03-14)
2
9
 
3
10
 
@@ -8,33 +8,53 @@ import UTBanner from '../UTBanner';
8
8
  import ownStyles from './styles';
9
9
 
10
10
  const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMarkdown, banner }) => {
11
+ const renderComponent = (prop, standardComponent) =>
12
+ React.isValidElement(prop) ? prop : standardComponent;
13
+
14
+ const Tagline = renderComponent(
15
+ tagline,
16
+ <Label disabled bold useMarkdown={useMarkdown} style={ownStyles.child}>
17
+ {tagline.toUpperCase()}
18
+ </Label>
19
+ );
20
+
21
+ const Title = renderComponent(
22
+ title,
23
+ <Label big bold style={ownStyles.title} useMarkdown={useMarkdown}>
24
+ {title}
25
+ </Label>
26
+ );
27
+
28
+ const Subtitle = renderComponent(
29
+ subtitle,
30
+ <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
31
+ {subtitle}
32
+ </Label>
33
+ );
34
+
35
+ const RequiredFieldInfo = renderComponent(
36
+ requiredFieldInfo,
37
+ <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
38
+ {requiredFieldInfo}
39
+ </Label>
40
+ );
41
+
42
+ const HelpText = renderComponent(
43
+ helpText,
44
+ <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
45
+ {helpText}
46
+ </Label>
47
+ );
48
+
11
49
  return (
12
50
  <View style={ownStyles.header}>
13
- {tagline && (
14
- <Label disabled bold useMarkdown={useMarkdown} style={ownStyles.child}>
15
- {tagline.toUpperCase()}
16
- </Label>
17
- )}
51
+ {!!tagline && Tagline}
18
52
  <View>
19
- <Label big bold style={ownStyles.title} useMarkdown={useMarkdown}>
20
- {title}
21
- </Label>
22
- {subtitle && (
23
- <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
24
- {subtitle}
25
- </Label>
26
- )}
53
+ {Title}
54
+ {!!subtitle && Subtitle}
27
55
  </View>
28
- {requiredFieldInfo && (
29
- <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
30
- {requiredFieldInfo}
31
- </Label>
32
- )}
33
- {helpText && (
34
- <Label disabled useMarkdown={useMarkdown} style={ownStyles.child}>
35
- {helpText}
36
- </Label>
37
- )}
56
+ {!!requiredFieldInfo && RequiredFieldInfo}
57
+ {!!helpText && HelpText}
38
58
  {banner?.text && <UTBanner text={banner.text} icon={banner.icon} style={{ banner: ownStyles.child }} />}
39
59
  </View>
40
60
  );
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.3.2",
5
+ "version": "1.3.3",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [