@utilitywarehouse/hearth-react-native 0.11.0 → 0.12.0
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +10 -0
- package/build/components/Banner/Banner.context.d.ts +7 -0
- package/build/components/Banner/Banner.context.js +8 -0
- package/build/components/Banner/Banner.js +10 -40
- package/build/components/Banner/Banner.props.d.ts +3 -5
- package/build/components/Banner/BannerIllustration.d.ts +4 -0
- package/build/components/Banner/BannerIllustration.js +53 -0
- package/build/components/Banner/BannerImage.d.ts +4 -0
- package/build/components/Banner/BannerImage.js +53 -0
- package/build/components/Banner/index.d.ts +2 -0
- package/build/components/Banner/index.js +2 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +2 -3
- package/build/components/Card/CardAction/CardActionRoot.js +1 -2
- package/build/components/Checkbox/Checkbox.js +1 -2
- package/build/components/Checkbox/Checkbox.props.d.ts +3 -3
- package/build/components/Checkbox/CheckboxImage.d.ts +2 -1
- package/build/components/Checkbox/CheckboxImage.js +8 -1
- package/build/components/ExpandableCard/ExpandableCard.props.d.ts +1 -2
- package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +4 -5
- package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +1 -14
- package/build/components/HighlightBanner/HighlightBanner.js +2 -6
- package/build/components/HighlightBanner/HighlightBanner.props.d.ts +2 -3
- package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
- package/build/components/HighlightBanner/HighlightBannerImage.js +18 -0
- package/build/components/HighlightBanner/index.d.ts +1 -0
- package/build/components/HighlightBanner/index.js +1 -0
- package/build/components/Input/Input.d.ts +5 -7
- package/build/components/Input/Input.js +11 -4
- package/build/components/Input/InputField.d.ts +4 -7
- package/build/components/Input/InputField.js +6 -5
- package/build/components/List/ListItem/ListItem.props.d.ts +2 -2
- package/build/components/List/ListItem/ListItemRoot.js +1 -2
- package/build/components/Modal/Modal.js +2 -6
- package/build/components/Modal/Modal.props.d.ts +3 -2
- package/build/components/Modal/Modal.web.js +2 -6
- package/build/components/Modal/ModalImage.d.ts +4 -0
- package/build/components/Modal/ModalImage.js +18 -0
- package/build/components/Modal/index.d.ts +1 -0
- package/build/components/Modal/index.js +1 -0
- package/build/components/Radio/Radio.js +1 -2
- package/build/components/Radio/Radio.props.d.ts +3 -3
- package/build/components/Radio/RadioImage.d.ts +2 -1
- package/build/components/Radio/RadioImage.js +8 -1
- package/build/utils/index.d.ts +2 -1
- package/build/utils/index.js +2 -1
- package/build/utils/isThemedImageProps.d.ts +4 -0
- package/build/utils/isThemedImageProps.js +4 -0
- package/package.json +2 -2
- package/src/components/Banner/Banner.context.ts +11 -0
- package/src/components/Banner/Banner.docs.mdx +55 -37
- package/src/components/Banner/Banner.props.ts +3 -5
- package/src/components/Banner/Banner.stories.tsx +86 -57
- package/src/components/Banner/Banner.tsx +24 -67
- package/src/components/Banner/BannerIllustration.tsx +63 -0
- package/src/components/Banner/BannerImage.tsx +63 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/Card/Card.docs.mdx +4 -4
- package/src/components/Card/CardAction/CardAction.props.ts +2 -3
- package/src/components/Card/CardAction/CardAction.stories.tsx +4 -3
- package/src/components/Card/CardAction/CardActionRoot.tsx +4 -5
- package/src/components/Checkbox/Checkbox.docs.mdx +23 -4
- package/src/components/Checkbox/Checkbox.props.ts +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +14 -8
- package/src/components/Checkbox/Checkbox.tsx +1 -2
- package/src/components/Checkbox/CheckboxImage.tsx +8 -3
- package/src/components/ExpandableCard/ExpandableCard.docs.mdx +2 -2
- package/src/components/ExpandableCard/ExpandableCard.props.ts +1 -2
- package/src/components/ExpandableCard/ExpandableCard.stories.tsx +3 -3
- package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +4 -5
- package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +2 -17
- package/src/components/HighlightBanner/HighlightBanner.docs.mdx +73 -42
- package/src/components/HighlightBanner/HighlightBanner.props.ts +2 -3
- package/src/components/HighlightBanner/HighlightBanner.stories.tsx +85 -60
- package/src/components/HighlightBanner/HighlightBanner.tsx +3 -10
- package/src/components/HighlightBanner/HighlightBannerImage.tsx +20 -0
- package/src/components/HighlightBanner/index.ts +1 -0
- package/src/components/Input/Input.stories.tsx +76 -3
- package/src/components/Input/Input.tsx +110 -98
- package/src/components/Input/InputField.tsx +27 -26
- package/src/components/List/List.docs.mdx +15 -9
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/List/ListItem/ListItem.props.ts +2 -2
- package/src/components/List/ListItem/ListItemRoot.tsx +2 -3
- package/src/components/Modal/Modal.docs.mdx +16 -4
- package/src/components/Modal/Modal.props.ts +3 -2
- package/src/components/Modal/Modal.stories.tsx +2 -5
- package/src/components/Modal/Modal.tsx +2 -6
- package/src/components/Modal/Modal.web.tsx +2 -6
- package/src/components/Modal/ModalImage.tsx +20 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/PillGroup/PillGroup.stories.tsx +1 -1
- package/src/components/Radio/Radio.docs.mdx +21 -8
- package/src/components/Radio/Radio.props.ts +3 -3
- package/src/components/Radio/Radio.stories.tsx +15 -11
- package/src/components/Radio/Radio.tsx +1 -2
- package/src/components/Radio/RadioImage.tsx +8 -3
- package/src/utils/index.ts +2 -1
- package/src/utils/isThemedImageProps.ts +8 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-native';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { ImageSourcePropType } from 'react-native';
|
|
4
|
-
import { Checkbox, CheckboxGroup } from '.';
|
|
4
|
+
import { Checkbox, CheckboxGroup, CheckboxImage } from '.';
|
|
5
5
|
import bankLogo from '../../../docs/assets/bank-logo.png';
|
|
6
6
|
import bankLogo1 from '../../../docs/assets/bank-logo1.png';
|
|
7
7
|
import { VariantTitle } from '../../../docs/components';
|
|
@@ -106,7 +106,12 @@ export const WithImage: Story = {
|
|
|
106
106
|
{...args}
|
|
107
107
|
value="visa"
|
|
108
108
|
label="Visa"
|
|
109
|
-
image={
|
|
109
|
+
image={
|
|
110
|
+
<CheckboxImage
|
|
111
|
+
source={bankLogo1 as ImageSourcePropType}
|
|
112
|
+
style={{ width: 40, height: 24 }}
|
|
113
|
+
/>
|
|
114
|
+
}
|
|
110
115
|
/>
|
|
111
116
|
<Checkbox
|
|
112
117
|
aria-label="Mastercard"
|
|
@@ -117,11 +122,12 @@ export const WithImage: Story = {
|
|
|
117
122
|
{...args}
|
|
118
123
|
value="mastercard"
|
|
119
124
|
label="Mastercard"
|
|
120
|
-
image={
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
image={
|
|
126
|
+
<CheckboxImage
|
|
127
|
+
source={bankLogo as ImageSourcePropType}
|
|
128
|
+
style={{ width: 40, height: 24, resizeMode: 'contain' }}
|
|
129
|
+
/>
|
|
130
|
+
}
|
|
125
131
|
/>
|
|
126
132
|
</CheckboxGroup>
|
|
127
133
|
),
|
|
@@ -5,7 +5,6 @@ import CheckboxProps from './Checkbox.props';
|
|
|
5
5
|
import { useCheckboxGroupContext } from './CheckboxGroup.context';
|
|
6
6
|
import StyledCheckboxGroup from './CheckboxGroupRoot';
|
|
7
7
|
import StyledCheckboxIcon from './CheckboxIcon';
|
|
8
|
-
import CheckboxImage from './CheckboxImage';
|
|
9
8
|
import StyledCheckboxIndicator from './CheckboxIndicator';
|
|
10
9
|
import StyledCheckboxLabel from './CheckboxLabel';
|
|
11
10
|
import StyledCheckbox from './CheckboxRoot';
|
|
@@ -57,7 +56,7 @@ const Checkbox = ({
|
|
|
57
56
|
<CheckboxIndicator>
|
|
58
57
|
<CheckboxIcon />
|
|
59
58
|
</CheckboxIndicator>
|
|
60
|
-
{image ?
|
|
59
|
+
{image ? image : null}
|
|
61
60
|
<CheckboxTextContent>
|
|
62
61
|
{!!label && <CheckboxLabel>{label}</CheckboxLabel>}
|
|
63
62
|
{!!helperText && <Helper disabled={disabled} icon={helperIcon} text={helperText} />}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Image, ImageProps } from 'react-native';
|
|
2
|
+
import { isThemedImageProps } from '../../utils';
|
|
3
|
+
import { ThemedImage, ThemedImageProps } from '../ThemedImage';
|
|
2
4
|
|
|
3
|
-
const CheckboxImage = ({
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const CheckboxImage = ({ ...props }: ImageProps | ThemedImageProps) => {
|
|
6
|
+
if (isThemedImageProps(props)) {
|
|
7
|
+
return <ThemedImage {...props} />;
|
|
8
|
+
}
|
|
9
|
+
return <Image {...props} />;
|
|
10
|
+
};
|
|
6
11
|
|
|
7
12
|
CheckboxImage.displayName = 'CheckboxImage';
|
|
8
13
|
|
|
@@ -64,7 +64,7 @@ const MyComponent = () => (
|
|
|
64
64
|
| `helperText` | `string` | - | Optional helper text displayed below the heading |
|
|
65
65
|
| `leadingIcon` | `ComponentType` | - | Leading icon component (automatically wrapped) |
|
|
66
66
|
| `leadingContent` | `ReactNode` | - | Leading content (icon or custom element) |
|
|
67
|
-
| `badge` | `
|
|
67
|
+
| `badge` | `ReactNode` | - | Badge to display |
|
|
68
68
|
| `badgePosition` | `'top' \| 'bottom'` | `'bottom'` | Badge position |
|
|
69
69
|
| `numericValue` | `string \| number` | - | Numeric value to display on the right |
|
|
70
70
|
| `expandedContent` | `ReactNode` | - | The content to show when expanded |
|
|
@@ -152,7 +152,7 @@ const MyComponent = () => (
|
|
|
152
152
|
<ExpandableCard
|
|
153
153
|
heading="New Feature"
|
|
154
154
|
helperText="Check out what's new"
|
|
155
|
-
badge={
|
|
155
|
+
badge={<Badge text="New" colorScheme="cyan" />}
|
|
156
156
|
expandedContent={<BodyText>We've added new features to improve your experience.</BodyText>}
|
|
157
157
|
/>
|
|
158
158
|
```
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import type BadgeProps from '../Badge/Badge.props';
|
|
3
2
|
import type CardProps from '../Card/Card.props';
|
|
4
3
|
|
|
5
4
|
export interface ExpandableCardProps extends Omit<CardProps, 'children'> {
|
|
@@ -36,7 +35,7 @@ export interface ExpandableCardProps extends Omit<CardProps, 'children'> {
|
|
|
36
35
|
/**
|
|
37
36
|
* Badge to display
|
|
38
37
|
*/
|
|
39
|
-
badge?:
|
|
38
|
+
badge?: ReactNode;
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Badge position
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SettingsMediumIcon,
|
|
8
8
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { BodyText, IconContainer, Link } from '../../components';
|
|
10
|
+
import { Badge, BodyText, IconContainer, Link } from '../../components';
|
|
11
11
|
import ExpandableCard from './ExpandableCard';
|
|
12
12
|
import ExpandableCardExpandedContent from './ExpandableCardExpandedContent';
|
|
13
13
|
import ExpandableCardGroup from './ExpandableCardGroup';
|
|
@@ -135,7 +135,7 @@ export const WithBadge: Story = {
|
|
|
135
135
|
<ExpandableCard
|
|
136
136
|
heading="New Feature"
|
|
137
137
|
helperText="Check out what's new"
|
|
138
|
-
badge={
|
|
138
|
+
badge={<Badge text="New" colorScheme="info" />}
|
|
139
139
|
expandedContent={
|
|
140
140
|
<BodyText>We've added new features to improve your experience. Explore them now!</BodyText>
|
|
141
141
|
}
|
|
@@ -264,7 +264,7 @@ export const GroupWithMixedContent: Story = {
|
|
|
264
264
|
<ExpandableCard
|
|
265
265
|
heading="Settings"
|
|
266
266
|
leadingContent={<ExpandableCardIcon as={SettingsMediumIcon} />}
|
|
267
|
-
badge={
|
|
267
|
+
badge={<Badge text="Updated" colorScheme="info" size="sm" />}
|
|
268
268
|
expandedContent={
|
|
269
269
|
<>
|
|
270
270
|
<BodyText>• Notification preferences</BodyText>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import type { PressableProps } from 'react-native';
|
|
3
|
-
import type BadgeProps from '../Badge/Badge.props';
|
|
4
3
|
|
|
5
4
|
export interface ExpandableCardTriggerProps extends Omit<PressableProps, 'children'> {
|
|
6
5
|
/**
|
|
@@ -18,11 +17,11 @@ export interface ExpandableCardTriggerProps extends Omit<PressableProps, 'childr
|
|
|
18
17
|
/**
|
|
19
18
|
* Content to display on the left side (e.g., icon, avatar)
|
|
20
19
|
*/
|
|
21
|
-
leadingContent?:
|
|
20
|
+
leadingContent?: ReactNode;
|
|
22
21
|
/**
|
|
23
22
|
* Optional badge to display
|
|
24
23
|
*/
|
|
25
|
-
badge?:
|
|
24
|
+
badge?: ReactNode;
|
|
26
25
|
/**
|
|
27
26
|
* Position of the badge relative to the heading
|
|
28
27
|
* @default 'bottom'
|
|
@@ -41,7 +40,7 @@ export interface ExpandableCardTriggerProps extends Omit<PressableProps, 'childr
|
|
|
41
40
|
*/
|
|
42
41
|
disabled?: boolean;
|
|
43
42
|
/* Optional children */
|
|
44
|
-
children?:
|
|
43
|
+
children?: ReactNode;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
export default ExpandableCardTriggerProps;
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
5
5
|
import { Pressable, ViewStyle } from 'react-native';
|
|
6
6
|
import { StyleSheet } from 'react-native-unistyles';
|
|
7
|
-
import { Badge } from '../Badge';
|
|
8
7
|
import { DetailText } from '../DetailText';
|
|
9
8
|
import ExpandableCardContent from './ExpandableCardContent';
|
|
10
9
|
import ExpandableCardHelperText from './ExpandableCardHelperText';
|
|
@@ -54,28 +53,14 @@ const ExpandableCardTriggerRoot = ({
|
|
|
54
53
|
return null;
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
const renderTopBadge = () => {
|
|
58
|
-
if (badgePosition === 'top' && badge) {
|
|
59
|
-
return <Badge {...badge} />;
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const renderBottomBadge = () => {
|
|
65
|
-
if (badgePosition === 'bottom' && badge) {
|
|
66
|
-
return <Badge {...badge} />;
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
56
|
const renderDefaultContent = () => (
|
|
72
57
|
<>
|
|
73
58
|
{renderLeadingContent()}
|
|
74
59
|
<ExpandableCardContent>
|
|
75
|
-
{
|
|
60
|
+
{badgePosition === 'top' ? badge : null}
|
|
76
61
|
<ExpandableCardText>{heading}</ExpandableCardText>
|
|
77
62
|
{helperText && <ExpandableCardHelperText>{helperText}</ExpandableCardHelperText>}
|
|
78
|
-
{
|
|
63
|
+
{badgePosition === 'bottom' ? badge : null}
|
|
79
64
|
</ExpandableCardContent>
|
|
80
65
|
{numericValue && (
|
|
81
66
|
<DetailText size="lg" style={styles.numericValue}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Canvas, Controls, Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { Button, Center, HighlightBanner, Link } from '../../';
|
|
2
|
+
import { Button, Center, HighlightBanner, HighlightBannerImage, Link } from '../../';
|
|
3
3
|
import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
|
|
4
4
|
import * as Stories from './HighlightBanner.stories';
|
|
5
5
|
|
|
@@ -39,11 +39,13 @@ A `HighlightBanner` component is a specialised card layout designed for highligh
|
|
|
39
39
|
<HighlightBanner
|
|
40
40
|
heading="Featured Content"
|
|
41
41
|
headingColor="energy"
|
|
42
|
-
image={
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
image={
|
|
43
|
+
<HighlightBannerImage
|
|
44
|
+
source={{
|
|
45
|
+
uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=800&q=80',
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
}
|
|
47
49
|
description="This is a description of the featured content that appears below the image."
|
|
48
50
|
/>
|
|
49
51
|
</Center>
|
|
@@ -56,11 +58,13 @@ const MyComponent = () => (
|
|
|
56
58
|
<HighlightBanner
|
|
57
59
|
heading="Featured Content"
|
|
58
60
|
headingColor="energy"
|
|
59
|
-
image={
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
image={
|
|
62
|
+
<HighlightBannerImage
|
|
63
|
+
source={{
|
|
64
|
+
uri: 'https://example.com/image.jpg',
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
}
|
|
64
68
|
description="This is a description of the featured content."
|
|
65
69
|
/>
|
|
66
70
|
);
|
|
@@ -72,7 +76,7 @@ const MyComponent = () => (
|
|
|
72
76
|
| -------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------ |
|
|
73
77
|
| heading | `string` | The heading text displayed at the top with colored background | `-` |
|
|
74
78
|
| headingColor | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | The semantic color scheme for the heading background | `-` |
|
|
75
|
-
| image | `
|
|
79
|
+
| image | `ReactNode` | The image component to be displayed in the banner | `-` |
|
|
76
80
|
| imageContainerHeight | `number` | Height of the image container in pixels | `200` |
|
|
77
81
|
| description | `string` | Description text displayed below the image | `-` |
|
|
78
82
|
| link | `ReactElement` | Optional Link component displayed below description | `-` |
|
|
@@ -81,6 +85,19 @@ const MyComponent = () => (
|
|
|
81
85
|
|
|
82
86
|
The component also accepts all standard Card props except `noPadding`, `colorScheme`, `space`, `gap`, `rowGap`, `columnGap`, `flexDirection`, `flexWrap`, `alignItems`, and `justifyContent`.
|
|
83
87
|
|
|
88
|
+
### `HighlightBannerImage` Props
|
|
89
|
+
|
|
90
|
+
The `HighlightBannerImage` component can be used to display an image within the HighlightBanner. It accepts the following props:
|
|
91
|
+
|
|
92
|
+
| Property | Type | Description |
|
|
93
|
+
| --------- | --------------------- | ------------------------------------------------------------------------ |
|
|
94
|
+
| `source` | `ImageSourcePropType` | The source of the image to display |
|
|
95
|
+
| `light` | `ImageSourcePropType` | The source of the image to display in light mode (use instead of source) |
|
|
96
|
+
| `dark` | `ImageSourcePropType` | The source of the image to display in dark mode (use instead of source) |
|
|
97
|
+
| `...rest` | `ImageProps` | Additional props to pass to the underlying Image component |
|
|
98
|
+
|
|
99
|
+
For more details about the ThemedImage component used internally, refer to the [`ThemedImage` documentation](/docs/utility-components-themed-image--docs).
|
|
100
|
+
|
|
84
101
|
## Variants
|
|
85
102
|
|
|
86
103
|
The HighlightBanner supports two visual variants:
|
|
@@ -97,17 +114,23 @@ Add a Button component to provide a clear call-to-action:
|
|
|
97
114
|
<Canvas of={Stories.WithButton} />
|
|
98
115
|
|
|
99
116
|
```jsx
|
|
100
|
-
import {
|
|
117
|
+
import {
|
|
118
|
+
HighlightBanner,
|
|
119
|
+
Button,
|
|
120
|
+
HighlightBannerImage,
|
|
121
|
+
} from '@utilitywarehouse/hearth-react-native';
|
|
101
122
|
|
|
102
123
|
const MyComponent = () => (
|
|
103
124
|
<HighlightBanner
|
|
104
125
|
heading="New Feature"
|
|
105
126
|
headingColor="energy"
|
|
106
|
-
image={
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
image={
|
|
128
|
+
<HighlightBannerImage
|
|
129
|
+
source={{
|
|
130
|
+
uri: 'https://example.com/feature.jpg',
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
111
134
|
description="Check out our latest feature"
|
|
112
135
|
button={<Button onPress={() => console.log('pressed')}>Get Started</Button>}
|
|
113
136
|
/>
|
|
@@ -121,17 +144,19 @@ Use a Link component for a lighter-weight action:
|
|
|
121
144
|
<Canvas of={Stories.WithLink} />
|
|
122
145
|
|
|
123
146
|
```jsx
|
|
124
|
-
import { HighlightBanner, Link } from '@utilitywarehouse/hearth-react-native';
|
|
147
|
+
import { HighlightBanner, Link, HighlightBannerImage } from '@utilitywarehouse/hearth-react-native';
|
|
125
148
|
|
|
126
149
|
const MyComponent = () => (
|
|
127
150
|
<HighlightBanner
|
|
128
151
|
heading="Learn More"
|
|
129
152
|
headingColor="broadband"
|
|
130
|
-
image={
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
153
|
+
image={
|
|
154
|
+
<HighlightBannerImage
|
|
155
|
+
source={{
|
|
156
|
+
uri: 'https://example.com/info.jpg',
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
}
|
|
135
160
|
description="Explore our documentation"
|
|
136
161
|
link={<Link onPress={() => console.log('pressed')}>Read more</Link>}
|
|
137
162
|
/>
|
|
@@ -145,7 +170,11 @@ Display the HighlightBanner without an image by omitting the `image` prop:
|
|
|
145
170
|
<Canvas of={Stories.WithoutImage} />
|
|
146
171
|
|
|
147
172
|
```jsx
|
|
148
|
-
import {
|
|
173
|
+
import {
|
|
174
|
+
HighlightBanner,
|
|
175
|
+
Button,
|
|
176
|
+
HighlightBannerImage,
|
|
177
|
+
} from '@utilitywarehouse/hearth-react-native';
|
|
149
178
|
|
|
150
179
|
const MyComponent = () => (
|
|
151
180
|
<HighlightBanner
|
|
@@ -163,7 +192,7 @@ The component supports seven semantic color schemes that automatically apply the
|
|
|
163
192
|
<Canvas of={Stories.ColorVariants} />
|
|
164
193
|
|
|
165
194
|
```jsx
|
|
166
|
-
import { HighlightBanner } from '@utilitywarehouse/hearth-react-native';
|
|
195
|
+
import { HighlightBanner, HighlightBannerImage } from '@utilitywarehouse/hearth-react-native';
|
|
167
196
|
|
|
168
197
|
const MyComponent = () => (
|
|
169
198
|
<>
|
|
@@ -171,7 +200,7 @@ const MyComponent = () => (
|
|
|
171
200
|
<HighlightBanner
|
|
172
201
|
heading="Energy Services"
|
|
173
202
|
headingColor="energy"
|
|
174
|
-
image={
|
|
203
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/energy.jpg' }} />}
|
|
175
204
|
description="Discover our energy solutions"
|
|
176
205
|
/>
|
|
177
206
|
|
|
@@ -179,7 +208,7 @@ const MyComponent = () => (
|
|
|
179
208
|
<HighlightBanner
|
|
180
209
|
heading="Broadband Deals"
|
|
181
210
|
headingColor="broadband"
|
|
182
|
-
image={
|
|
211
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/broadband.jpg' }} />}
|
|
183
212
|
description="Fast and reliable broadband"
|
|
184
213
|
/>
|
|
185
214
|
|
|
@@ -187,7 +216,7 @@ const MyComponent = () => (
|
|
|
187
216
|
<HighlightBanner
|
|
188
217
|
heading="Insurance Coverage"
|
|
189
218
|
headingColor="insurance"
|
|
190
|
-
image={
|
|
219
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/insurance.jpg' }} />}
|
|
191
220
|
description="Protect what matters most"
|
|
192
221
|
/>
|
|
193
222
|
|
|
@@ -195,7 +224,7 @@ const MyComponent = () => (
|
|
|
195
224
|
<HighlightBanner
|
|
196
225
|
heading="Mobile Plans"
|
|
197
226
|
headingColor="mobile"
|
|
198
|
-
image={
|
|
227
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/mobile.jpg' }} />}
|
|
199
228
|
description="Stay connected anywhere"
|
|
200
229
|
/>
|
|
201
230
|
|
|
@@ -203,7 +232,7 @@ const MyComponent = () => (
|
|
|
203
232
|
<HighlightBanner
|
|
204
233
|
heading="Cashback Rewards"
|
|
205
234
|
headingColor="cashback"
|
|
206
|
-
image={
|
|
235
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/cashback.jpg' }} />}
|
|
207
236
|
description="Earn rewards on your bills"
|
|
208
237
|
/>
|
|
209
238
|
|
|
@@ -211,7 +240,7 @@ const MyComponent = () => (
|
|
|
211
240
|
<HighlightBanner
|
|
212
241
|
heading="Savings Account"
|
|
213
242
|
headingColor="pig"
|
|
214
|
-
image={
|
|
243
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/savings.jpg' }} />}
|
|
215
244
|
description="Save for your future"
|
|
216
245
|
/>
|
|
217
246
|
|
|
@@ -219,7 +248,7 @@ const MyComponent = () => (
|
|
|
219
248
|
<HighlightBanner
|
|
220
249
|
heading="Special Offer"
|
|
221
250
|
headingColor="highlight"
|
|
222
|
-
image={
|
|
251
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/offer.jpg' }} />}
|
|
223
252
|
description="Limited time promotion"
|
|
224
253
|
/>
|
|
225
254
|
</>
|
|
@@ -233,18 +262,20 @@ Use the subtle variant for a softer, less prominent appearance:
|
|
|
233
262
|
<Canvas of={Stories.SubtleCard} />
|
|
234
263
|
|
|
235
264
|
```jsx
|
|
236
|
-
import { HighlightBanner } from '@utilitywarehouse/hearth-react-native';
|
|
265
|
+
import { HighlightBanner, HighlightBannerImage } from '@utilitywarehouse/hearth-react-native';
|
|
237
266
|
|
|
238
267
|
const MyComponent = () => (
|
|
239
268
|
<HighlightBanner
|
|
240
269
|
variant="subtle"
|
|
241
270
|
heading="Featured Content"
|
|
242
271
|
headingColor="energy"
|
|
243
|
-
image={
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
272
|
+
image={
|
|
273
|
+
<HighlightBannerImage
|
|
274
|
+
source={{
|
|
275
|
+
uri: 'https://example.com/image.jpg',
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
}
|
|
248
279
|
description="This banner has a subtle appearance"
|
|
249
280
|
/>
|
|
250
281
|
);
|
|
@@ -261,7 +292,7 @@ The component works well with various types of imagery:
|
|
|
261
292
|
Control the image container height to suit your content needs:
|
|
262
293
|
|
|
263
294
|
```jsx
|
|
264
|
-
import { HighlightBanner } from '@utilitywarehouse/hearth-react-native';
|
|
295
|
+
import { HighlightBanner, HighlightBannerImage } from '@utilitywarehouse/hearth-react-native';
|
|
265
296
|
|
|
266
297
|
const MyComponent = () => (
|
|
267
298
|
<>
|
|
@@ -269,7 +300,7 @@ const MyComponent = () => (
|
|
|
269
300
|
<HighlightBanner
|
|
270
301
|
heading="Standard Image"
|
|
271
302
|
headingColor="energy"
|
|
272
|
-
image={
|
|
303
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/image.jpg' }} />}
|
|
273
304
|
description="Using default height"
|
|
274
305
|
/>
|
|
275
306
|
|
|
@@ -277,7 +308,7 @@ const MyComponent = () => (
|
|
|
277
308
|
<HighlightBanner
|
|
278
309
|
heading="Tall Image"
|
|
279
310
|
headingColor="broadband"
|
|
280
|
-
image={
|
|
311
|
+
image={<HighlightBannerImage source={{ uri: 'https://example.com/tall-image.jpg' }} />}
|
|
281
312
|
imageContainerHeight={300}
|
|
282
313
|
description="Using custom height of 300px"
|
|
283
314
|
/>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { ImageProps } from 'react-native';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
2
|
import CardProps from '../Card/Card.props';
|
|
4
3
|
|
|
5
4
|
interface HighlightBannerProps
|
|
@@ -20,7 +19,7 @@ interface HighlightBannerProps
|
|
|
20
19
|
heading?: string;
|
|
21
20
|
headingColor?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
|
|
22
21
|
variant?: 'emphasis' | 'subtle';
|
|
23
|
-
image?:
|
|
22
|
+
image?: ReactNode;
|
|
24
23
|
imageContainerHeight?: number;
|
|
25
24
|
description?: string;
|
|
26
25
|
link?: ReactElement;
|