@utilitywarehouse/hearth-react-native 0.8.0 → 0.8.1

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.8.0 build /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.8.1 build /home/runner/work/hearth/hearth/packages/react-native
3
3
  > tsc
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.8.0 lint /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.8.1 lint /home/runner/work/hearth/hearth/packages/react-native
3
3
  > TIMING=1 eslint --max-warnings 0
4
4
 
5
5
  Rule | Time (ms) | Relative
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @utilitywarehouse/hearth-react-native
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#641](https://github.com/utilitywarehouse/hearth/pull/641) [`251242e`](https://github.com/utilitywarehouse/hearth/commit/251242e218c0b24589c3fb6fb6963b53bda8a367) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes `HighlightBanner` when no image is provided
8
+
3
9
  ## 0.8.0
4
10
 
5
11
  ### Minor Changes
@@ -4,8 +4,8 @@ import { StyleSheet } from 'react-native-unistyles';
4
4
  import { BodyText } from '../BodyText';
5
5
  import { Card } from '../Card';
6
6
  const HighlightBanner = ({ heading, headingColor, image, imageContainerHeight, description, link, button, variant = 'emphasis', style, ...props }) => {
7
- styles.useVariants({ headingColor, variant });
8
- return (_jsx(Card, { variant: variant, noPadding: true, style: style, ...props, children: _jsxs(View, { style: [styles.container], children: [_jsx(View, { style: [styles.header], children: _jsx(BodyText, { size: "md", textAlign: "center", weight: "semibold", children: heading }) }), _jsx(View, { style: styles.imageContainer(imageContainerHeight), children: _jsx(Image, { resizeMode: "cover", ...image, style: [styles.image, image?.style] }) }), _jsxs(View, { style: styles.footer, children: [_jsx(BodyText, { size: "md", textAlign: "center", children: description }), link && _jsx(View, { style: styles.linkContainer, children: link }), button && _jsx(View, { style: styles.buttonContainer, children: button })] })] }) }));
7
+ styles.useVariants({ headingColor, variant, hasImage: Boolean(image) });
8
+ return (_jsx(Card, { variant: variant, noPadding: true, style: style, ...props, children: _jsxs(View, { style: [styles.container], children: [_jsx(View, { style: [styles.header], children: _jsx(BodyText, { size: "md", textAlign: "center", weight: "semibold", children: heading }) }), !!image && (_jsx(View, { style: styles.imageContainer(imageContainerHeight), children: _jsx(Image, { resizeMode: "cover", ...image, style: [styles.image, image?.style] }) })), _jsxs(View, { style: styles.footer, children: [_jsx(BodyText, { size: "md", textAlign: "center", children: description }), link && _jsx(View, { style: styles.linkContainer, children: link }), button && _jsx(View, { style: styles.buttonContainer, children: button })] })] }) }));
9
9
  };
10
10
  HighlightBanner.displayName = 'HighlightBanner';
11
11
  const styles = StyleSheet.create(theme => ({
@@ -51,6 +51,11 @@ const styles = StyleSheet.create(theme => ({
51
51
  borderColor: theme.color.border.subtle,
52
52
  },
53
53
  },
54
+ hasImage: {
55
+ false: {
56
+ borderBottomWidth: 0,
57
+ },
58
+ },
54
59
  },
55
60
  },
56
61
  imageContainer: (height = 200) => ({
@@ -74,6 +79,11 @@ const styles = StyleSheet.create(theme => ({
74
79
  borderColor: theme.color.border.subtle,
75
80
  },
76
81
  },
82
+ hasImage: {
83
+ true: {
84
+ flex: 1,
85
+ },
86
+ },
77
87
  },
78
88
  },
79
89
  linkContainer: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Utility Warehouse React Native UI library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -56,10 +56,10 @@
56
56
  "vite": "^7.1.3",
57
57
  "vite-plugin-svgr": "^4.5.0",
58
58
  "vitest": "^3.2.4",
59
- "@utilitywarehouse/hearth-fonts": "^0.0.4",
60
- "@utilitywarehouse/hearth-react-icons": "^0.7.2",
61
- "@utilitywarehouse/hearth-react-native-icons": "^0.7.2",
59
+ "@utilitywarehouse/hearth-react-icons": "^0.7.3",
60
+ "@utilitywarehouse/hearth-react-native-icons": "^0.7.3",
62
61
  "@utilitywarehouse/hearth-svg-assets": "^0.2.0",
62
+ "@utilitywarehouse/hearth-fonts": "^0.0.4",
63
63
  "@utilitywarehouse/hearth-tokens": "^0.1.3"
64
64
  },
65
65
  "peerDependencies": {
@@ -11,7 +11,7 @@ import * as Stories from './HighlightBanner.stories';
11
11
 
12
12
  # Highlight Banner
13
13
 
14
- A `HighlightBanner` component is a specialised card layout designed for highlighting featured content with an image. It combines a colored heading banner, an image, and descriptive text with optional action buttons or links. Perfect for promotional content, featured articles, or important announcements.
14
+ A `HighlightBanner` component is a specialised card layout designed for highlighting featured content with an image. It combines a colored heading banner, an optional image, and descriptive text with optional action buttons or links. Perfect for promotional content, featured articles, or important announcements.
15
15
 
16
16
  - [Playground](#playground)
17
17
  - [Usage](#usage)
@@ -20,6 +20,7 @@ A `HighlightBanner` component is a specialised card layout designed for highligh
20
20
  - [Examples](#examples)
21
21
  - [With Button](#with-button)
22
22
  - [With Link](#with-link)
23
+ - [Without Image](#without-image)
23
24
  - [Color Variants](#color-variants)
24
25
  - [Subtle Variant](#subtle-variant)
25
26
  - [Different Images](#different-images)
@@ -137,6 +138,24 @@ const MyComponent = () => (
137
138
  );
138
139
  ```
139
140
 
141
+ ### Without Image
142
+
143
+ Display the HighlightBanner without an image by omitting the `image` prop:
144
+
145
+ <Canvas of={Stories.WithoutImage} />
146
+
147
+ ```jsx
148
+ import { HighlightBanner, Button } from '@utilitywarehouse/hearth-react-native';
149
+
150
+ const MyComponent = () => (
151
+ <HighlightBanner
152
+ heading="Content Without Image"
153
+ description="This HighlightBanner does not have an image, focusing solely on the text content."
154
+ button={<Button onPress={() => console.log('pressed')}>Discover More</Button>}
155
+ />
156
+ );
157
+ ```
158
+
140
159
  ### Color Variants
141
160
 
142
161
  The component supports seven semantic color schemes that automatically apply the appropriate subtle background colors:
@@ -174,6 +174,22 @@ export const ColorVariants: Story = {
174
174
  },
175
175
  };
176
176
 
177
+ export const WithoutImage: Story = {
178
+ render: args => {
179
+ return (
180
+ <View style={{ width: 400 }}>
181
+ <HighlightBanner
182
+ {...args}
183
+ image={undefined}
184
+ heading="Content Without Image"
185
+ description="This HighlightBanner does not have an image, focusing solely on the text content."
186
+ button={<Button onPress={() => console.log('pressed')}>Discover More</Button>}
187
+ />
188
+ </View>
189
+ );
190
+ },
191
+ };
192
+
177
193
  export const SubtleCard: Story = {
178
194
  args: {
179
195
  variant: 'subtle',
@@ -16,7 +16,7 @@ const HighlightBanner = ({
16
16
  style,
17
17
  ...props
18
18
  }: HighlightBannerProps) => {
19
- styles.useVariants({ headingColor, variant });
19
+ styles.useVariants({ headingColor, variant, hasImage: Boolean(image) });
20
20
 
21
21
  return (
22
22
  <Card variant={variant} noPadding style={style} {...props}>
@@ -26,9 +26,11 @@ const HighlightBanner = ({
26
26
  {heading}
27
27
  </BodyText>
28
28
  </View>
29
- <View style={styles.imageContainer(imageContainerHeight)}>
30
- <Image resizeMode="cover" {...image} style={[styles.image, image?.style]} />
31
- </View>
29
+ {!!image && (
30
+ <View style={styles.imageContainer(imageContainerHeight)}>
31
+ <Image resizeMode="cover" {...image} style={[styles.image, image?.style]} />
32
+ </View>
33
+ )}
32
34
  <View style={styles.footer}>
33
35
  <BodyText size="md" textAlign="center">
34
36
  {description}
@@ -86,6 +88,11 @@ const styles = StyleSheet.create(theme => ({
86
88
  borderColor: theme.color.border.subtle,
87
89
  },
88
90
  },
91
+ hasImage: {
92
+ false: {
93
+ borderBottomWidth: 0,
94
+ },
95
+ },
89
96
  },
90
97
  },
91
98
  imageContainer: (height: number = 200) => ({
@@ -109,6 +116,11 @@ const styles = StyleSheet.create(theme => ({
109
116
  borderColor: theme.color.border.subtle,
110
117
  },
111
118
  },
119
+ hasImage: {
120
+ true: {
121
+ flex: 1,
122
+ },
123
+ },
112
124
  },
113
125
  },
114
126
  linkContainer: {