@utilitywarehouse/hearth-react-native 0.6.0 → 0.8.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/.storybook/main.ts +12 -6
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +18 -0
- package/build/components/Banner/Banner.d.ts +6 -0
- package/build/components/Banner/Banner.js +161 -0
- package/build/components/Banner/Banner.props.d.ts +82 -0
- package/build/components/Banner/Banner.props.js +1 -0
- package/build/components/Banner/index.d.ts +2 -0
- package/build/components/Banner/index.js +1 -0
- package/build/components/BottomSheet/BottomSheetBackdrop.js +1 -5
- package/build/components/BottomSheet/BottomSheetFlatList.js +1 -5
- package/build/components/BottomSheet/BottomSheetHandle.js +1 -5
- package/build/components/BottomSheet/useBottomSheetLogic.d.ts +1 -1
- package/build/components/Button/ButtonIcon.js +2 -1
- package/build/components/Button/ButtonRoot.js +2 -6
- package/build/components/Button/ButtonText.js +4 -1
- package/build/components/Card/Card.context.d.ts +7 -0
- package/build/components/Card/CardAction/CardAction.context.d.ts +9 -0
- package/build/components/Card/{CardAction.context.js → CardAction/CardAction.context.js} +7 -1
- package/build/components/Card/CardAction/CardAction.d.ts +18 -0
- package/build/components/Card/CardAction/CardAction.js +7 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +63 -0
- package/build/components/Card/CardAction/CardAction.props.js +1 -0
- package/build/components/Card/CardAction/CardActionContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionContent.js +13 -0
- package/build/components/Card/CardAction/CardActionHelperText.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionHelperText.js +13 -0
- package/build/components/Card/CardAction/CardActionIcon.d.ts +9 -0
- package/build/components/Card/CardAction/CardActionIcon.js +19 -0
- package/build/components/Card/CardAction/CardActionLeadingContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionLeadingContent.js +5 -0
- package/build/components/Card/CardAction/CardActionRoot.d.ts +12 -0
- package/build/components/Card/CardAction/CardActionRoot.js +155 -0
- package/build/components/Card/CardAction/CardActionText.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionText.js +9 -0
- package/build/components/Card/CardAction/CardActionTrailingContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionTrailingContent.js +5 -0
- package/build/components/Card/CardAction/CardActionTrailingIcon.d.ts +9 -0
- package/build/components/Card/CardAction/CardActionTrailingIcon.js +19 -0
- package/build/components/Card/CardAction/index.d.ts +10 -0
- package/build/components/Card/CardAction/index.js +9 -0
- package/build/components/Card/CardContent.d.ts +6 -0
- package/build/components/Card/CardContent.js +33 -0
- package/build/components/Card/CardPressHandler.context.d.ts +6 -0
- package/build/components/Card/CardPressHandler.context.js +6 -0
- package/build/components/Card/{CardAction.d.ts → CardPressHandler.d.ts} +3 -3
- package/build/components/Card/CardPressHandler.js +13 -0
- package/build/components/Card/CardRoot.js +103 -11
- package/build/components/Card/index.d.ts +3 -2
- package/build/components/Card/index.js +3 -2
- package/build/components/Checkbox/CheckboxIcon.js +2 -1
- package/build/components/Container/Container.js +3 -3
- package/build/components/CurrencyInput/CurrencyInput.js +1 -1
- package/build/components/Expandable/Expandable.d.ts +6 -0
- package/build/components/Expandable/Expandable.js +44 -0
- package/build/components/Expandable/Expandable.props.d.ts +38 -0
- package/build/components/Expandable/Expandable.props.js +1 -0
- package/build/components/Expandable/index.d.ts +2 -0
- package/build/components/Expandable/index.js +1 -0
- package/build/components/ExpandableCard/ExpandableCard.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCard.js +23 -0
- package/build/components/ExpandableCard/ExpandableCard.props.d.ts +69 -0
- package/build/components/ExpandableCard/ExpandableCard.props.js +1 -0
- package/build/components/ExpandableCard/ExpandableCardContent.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardContent.js +14 -0
- package/build/components/ExpandableCard/ExpandableCardExpandedContent.d.ts +11 -0
- package/build/components/ExpandableCard/ExpandableCardExpandedContent.js +18 -0
- package/build/components/ExpandableCard/ExpandableCardGroup.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardGroup.js +17 -0
- package/build/components/ExpandableCard/ExpandableCardGroup.props.d.ts +25 -0
- package/build/components/ExpandableCard/ExpandableCardGroup.props.js +1 -0
- package/build/components/ExpandableCard/ExpandableCardHelperText.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardHelperText.js +13 -0
- package/build/components/ExpandableCard/ExpandableCardIcon.d.ts +9 -0
- package/build/components/ExpandableCard/ExpandableCardIcon.js +19 -0
- package/build/components/ExpandableCard/ExpandableCardLeadingContent.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardLeadingContent.js +5 -0
- package/build/components/ExpandableCard/ExpandableCardText.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardText.js +7 -0
- package/build/components/ExpandableCard/ExpandableCardTrailingContent.d.ts +6 -0
- package/build/components/ExpandableCard/ExpandableCardTrailingContent.js +5 -0
- package/build/components/ExpandableCard/ExpandableCardTrailingIcon.d.ts +9 -0
- package/build/components/ExpandableCard/ExpandableCardTrailingIcon.js +17 -0
- package/build/components/ExpandableCard/ExpandableCardTrigger.d.ts +17 -0
- package/build/components/ExpandableCard/ExpandableCardTrigger.js +7 -0
- package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +44 -0
- package/build/components/ExpandableCard/ExpandableCardTrigger.props.js +1 -0
- package/build/components/ExpandableCard/ExpandableCardTriggerRoot.d.ts +11 -0
- package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +91 -0
- package/build/components/ExpandableCard/index.d.ts +14 -0
- package/build/components/ExpandableCard/index.js +11 -0
- package/build/components/Helper/HelperIcon.js +2 -1
- package/build/components/HighlightBanner/HighlightBanner.d.ts +6 -0
- package/build/components/HighlightBanner/HighlightBanner.js +86 -0
- package/build/components/HighlightBanner/HighlightBanner.props.d.ts +14 -0
- package/build/components/HighlightBanner/HighlightBanner.props.js +1 -0
- package/build/components/HighlightBanner/index.d.ts +2 -0
- package/build/components/HighlightBanner/index.js +1 -0
- package/build/components/Icon/Icon.d.ts +2 -6
- package/build/components/IconButton/IconButtonIcon.js +2 -1
- package/build/components/IconContainer/IconContainer.d.ts +4 -3
- package/build/components/IconContainer/IconContainer.js +3 -3
- package/build/components/Input/InputField.js +4 -2
- package/build/components/Input/InputIcon.js +2 -1
- package/build/components/Link/LinkIcon.js +3 -2
- package/build/components/List/ListAction/ListActionTrailingIcon.js +2 -1
- package/build/components/List/ListItem/ListItemIcon.js +2 -1
- package/build/components/List/ListItem/ListItemTrailingIcon.js +2 -3
- package/build/components/Radio/RadioIcon.js +7 -2
- package/build/components/RadioCard/RadioCardIcon.js +3 -2
- package/build/components/Spinner/Spinner.web.d.ts +2 -1
- package/build/components/Switch/Switch.js +5 -3
- package/build/components/Textarea/TextareaField.js +1 -1
- package/build/components/ToggleButton/ToggleButtonIcon.js +2 -1
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +2 -1
- package/build/components/index.d.ts +5 -1
- package/build/components/index.js +5 -1
- package/build/core/index.d.ts +3 -3
- package/build/core/index.js +3 -3
- package/build/core/themes.d.ts +24 -12
- package/build/hooks/useColorMode.d.ts +1 -1
- package/build/hooks/useColorMode.js +7 -8
- package/build/tokens/components/dark/banner.d.ts +19 -0
- package/build/tokens/components/dark/banner.js +19 -0
- package/build/tokens/components/dark/card-action.d.ts +11 -0
- package/build/tokens/components/dark/card-action.js +10 -0
- package/build/tokens/components/dark/card-content.d.ts +25 -0
- package/build/tokens/components/dark/card-content.js +24 -0
- package/build/tokens/components/dark/drawer.d.ts +29 -0
- package/build/tokens/components/dark/drawer.js +28 -0
- package/build/tokens/components/dark/illustrations.d.ts +0 -1
- package/build/tokens/components/dark/illustrations.js +0 -1
- package/build/tokens/components/dark/index.d.ts +3 -0
- package/build/tokens/components/dark/index.js +3 -0
- package/build/tokens/components/light/banner.d.ts +19 -0
- package/build/tokens/components/light/banner.js +19 -0
- package/build/tokens/components/light/card-action.d.ts +11 -0
- package/build/tokens/components/light/card-action.js +10 -0
- package/build/tokens/components/light/card-content.d.ts +25 -0
- package/build/tokens/components/light/card-content.js +24 -0
- package/build/tokens/components/light/drawer.d.ts +29 -0
- package/build/tokens/components/light/drawer.js +28 -0
- package/build/tokens/components/light/illustrations.d.ts +0 -1
- package/build/tokens/components/light/illustrations.js +0 -1
- package/build/tokens/components/light/index.d.ts +3 -0
- package/build/tokens/components/light/index.js +3 -0
- package/build/tokens/layout.d.ts +6 -6
- package/build/tokens/layout.js +3 -3
- package/build/tokens/typography.d.ts +6 -0
- package/build/tokens/typography.js +3 -0
- package/docs/components/AllComponents.web.tsx +75 -4
- package/docs/components/NextPrevPage.tsx +5 -5
- package/docs/components/VariantTitle.tsx +17 -7
- package/package.json +16 -14
- package/src/components/Banner/Banner.docs.mdx +402 -0
- package/src/components/Banner/Banner.props.ts +106 -0
- package/src/components/Banner/Banner.stories.tsx +494 -0
- package/src/components/Banner/Banner.tsx +264 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/BottomSheet/BottomSheetBackdrop.tsx +1 -2
- package/src/components/BottomSheet/BottomSheetFlatList.tsx +1 -3
- package/src/components/BottomSheet/BottomSheetHandle.tsx +0 -1
- package/src/components/Button/ButtonIcon.tsx +2 -1
- package/src/components/Button/ButtonRoot.tsx +2 -6
- package/src/components/Button/ButtonText.tsx +4 -1
- package/src/components/Card/Card.context.ts +7 -0
- package/src/components/Card/Card.docs.mdx +221 -15
- package/src/components/Card/Card.stories.tsx +50 -3
- package/src/components/Card/CardAction/CardAction.context.ts +22 -0
- package/src/components/Card/CardAction/CardAction.props.ts +87 -0
- package/src/components/Card/CardAction/CardAction.stories.tsx +265 -0
- package/src/components/Card/CardAction/CardAction.tsx +10 -0
- package/src/components/Card/CardAction/CardActionContent.tsx +20 -0
- package/src/components/Card/CardAction/CardActionHelperText.tsx +21 -0
- package/src/components/Card/CardAction/CardActionIcon.tsx +32 -0
- package/src/components/Card/CardAction/CardActionLeadingContent.tsx +9 -0
- package/src/components/Card/CardAction/CardActionRoot.tsx +258 -0
- package/src/components/Card/CardAction/CardActionText.tsx +17 -0
- package/src/components/Card/CardAction/CardActionTrailingContent.tsx +9 -0
- package/src/components/Card/CardAction/CardActionTrailingIcon.tsx +32 -0
- package/src/components/Card/CardAction/index.ts +10 -0
- package/src/components/Card/CardContent.tsx +40 -0
- package/src/components/Card/CardPressHandler.context.ts +12 -0
- package/src/components/Card/CardPressHandler.tsx +20 -0
- package/src/components/Card/CardRoot.tsx +128 -13
- package/src/components/Card/index.ts +3 -2
- package/src/components/Checkbox/CheckboxIcon.tsx +2 -1
- package/src/components/Container/Container.tsx +3 -3
- package/src/components/CurrencyInput/CurrencyInput.tsx +1 -1
- package/src/components/Expandable/Expandable.docs.mdx +201 -0
- package/src/components/Expandable/Expandable.props.ts +46 -0
- package/src/components/Expandable/Expandable.stories.tsx +284 -0
- package/src/components/Expandable/Expandable.tsx +92 -0
- package/src/components/Expandable/index.ts +2 -0
- package/src/components/ExpandableCard/ExpandableCard.docs.mdx +312 -0
- package/src/components/ExpandableCard/ExpandableCard.props.ts +85 -0
- package/src/components/ExpandableCard/ExpandableCard.stories.tsx +326 -0
- package/src/components/ExpandableCard/ExpandableCard.tsx +76 -0
- package/src/components/ExpandableCard/ExpandableCardContent.tsx +21 -0
- package/src/components/ExpandableCard/ExpandableCardExpandedContent.tsx +42 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.props.ts +31 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.tsx +40 -0
- package/src/components/ExpandableCard/ExpandableCardHelperText.tsx +21 -0
- package/src/components/ExpandableCard/ExpandableCardIcon.tsx +32 -0
- package/src/components/ExpandableCard/ExpandableCardLeadingContent.tsx +9 -0
- package/src/components/ExpandableCard/ExpandableCardText.tsx +14 -0
- package/src/components/ExpandableCard/ExpandableCardTrailingContent.tsx +9 -0
- package/src/components/ExpandableCard/ExpandableCardTrailingIcon.tsx +30 -0
- package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +47 -0
- package/src/components/ExpandableCard/ExpandableCardTrigger.tsx +10 -0
- package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +154 -0
- package/src/components/ExpandableCard/index.ts +14 -0
- package/src/components/Helper/HelperIcon.tsx +2 -1
- package/src/components/HighlightBanner/HighlightBanner.docs.mdx +277 -0
- package/src/components/HighlightBanner/HighlightBanner.props.ts +29 -0
- package/src/components/HighlightBanner/HighlightBanner.stories.tsx +259 -0
- package/src/components/HighlightBanner/HighlightBanner.tsx +122 -0
- package/src/components/HighlightBanner/index.ts +2 -0
- package/src/components/Icon/Icon.tsx +4 -3
- package/src/components/IconButton/IconButtonIcon.tsx +2 -1
- package/src/components/IconContainer/IconContainer.tsx +17 -19
- package/src/components/Input/InputField.tsx +2 -1
- package/src/components/Input/InputIcon.tsx +2 -1
- package/src/components/Link/LinkIcon.tsx +3 -2
- package/src/components/List/ListAction/ListActionTrailingIcon.tsx +2 -1
- package/src/components/List/ListItem/ListItemIcon.tsx +2 -1
- package/src/components/List/ListItem/ListItemTrailingIcon.tsx +2 -3
- package/src/components/Radio/RadioIcon.tsx +8 -3
- package/src/components/RadioCard/RadioCardIcon.tsx +4 -3
- package/src/components/Switch/Switch.tsx +10 -5
- package/src/components/Switch/Switch.web.tsx +1 -0
- package/src/components/Textarea/TextareaField.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonIcon.tsx +2 -1
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +2 -1
- package/src/components/index.ts +5 -9
- package/src/core/index.ts +14 -11
- package/src/hooks/useColorMode.ts +9 -12
- package/src/tokens/components/dark/banner.ts +19 -0
- package/src/tokens/components/dark/card-action.ts +11 -0
- package/src/tokens/components/dark/card-content.ts +25 -0
- package/src/tokens/components/dark/drawer.ts +29 -0
- package/src/tokens/components/dark/illustrations.ts +0 -1
- package/src/tokens/components/dark/index.ts +3 -0
- package/src/tokens/components/light/banner.ts +19 -0
- package/src/tokens/components/light/card-action.ts +11 -0
- package/src/tokens/components/light/card-content.ts +25 -0
- package/src/tokens/components/light/drawer.ts +29 -0
- package/src/tokens/components/light/illustrations.ts +0 -1
- package/src/tokens/components/light/index.ts +3 -0
- package/src/tokens/layout.ts +3 -3
- package/src/tokens/typography.ts +3 -0
- package/build/components/Card/CardAction.context.d.ts +0 -6
- package/build/components/Card/CardAction.js +0 -13
- package/src/components/Card/CardAction.context.ts +0 -12
- package/src/components/Card/CardAction.tsx +0 -18
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { Canvas, Controls, Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { Banner, Button, Center, Link } from '../../';
|
|
4
|
+
import { BackToTopButton, UsageWrap, ViewFigmaButton } from '../../../docs/components';
|
|
5
|
+
import * as Stories from './Banner.stories';
|
|
6
|
+
|
|
7
|
+
<Meta title="Components / Banner" />
|
|
8
|
+
|
|
9
|
+
<BackToTopButton />
|
|
10
|
+
|
|
11
|
+
# Banner
|
|
12
|
+
|
|
13
|
+
The `Banner` component is a versatile card-based component for displaying informational content with an icon or image. It supports various layouts, interactive features like pressable states and close buttons, and optional action elements like buttons or links.
|
|
14
|
+
|
|
15
|
+
- [Playground](#playground)
|
|
16
|
+
- [Usage](#usage)
|
|
17
|
+
- [Props](#props)
|
|
18
|
+
- [Layout Options](#layout-options)
|
|
19
|
+
- [Examples](#examples)
|
|
20
|
+
- [With Icon](#with-icon)
|
|
21
|
+
- [With Image](#with-image)
|
|
22
|
+
- [With Illustration](#with-illustration)
|
|
23
|
+
- [With Button](#with-button)
|
|
24
|
+
- [With Link](#with-link)
|
|
25
|
+
- [Pressable](#pressable)
|
|
26
|
+
- [With Close Button](#with-close-button)
|
|
27
|
+
- [Vertical Layout](#vertical-layout)
|
|
28
|
+
- [Color Schemes](#color-schemes)
|
|
29
|
+
- [Complex Examples](#complex-examples)
|
|
30
|
+
|
|
31
|
+
## Playground
|
|
32
|
+
|
|
33
|
+
<Canvas of={Stories.Playground} />
|
|
34
|
+
|
|
35
|
+
<Controls of={Stories.Playground} />
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
<UsageWrap>
|
|
40
|
+
<Center>
|
|
41
|
+
<Banner
|
|
42
|
+
icon={ElectricityMediumIcon}
|
|
43
|
+
iconContainerColor="energy"
|
|
44
|
+
heading="Energy Services"
|
|
45
|
+
description="Manage your energy account and view your usage."
|
|
46
|
+
/>
|
|
47
|
+
</Center>
|
|
48
|
+
</UsageWrap>
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
52
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
53
|
+
|
|
54
|
+
const MyComponent = () => (
|
|
55
|
+
<Banner
|
|
56
|
+
icon={ElectricityMediumIcon}
|
|
57
|
+
iconContainerColor="energy"
|
|
58
|
+
heading="Energy Services"
|
|
59
|
+
description="Manage your energy account and view your usage."
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Props
|
|
65
|
+
|
|
66
|
+
| Property | Type | Description | Default |
|
|
67
|
+
| -------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------------- |
|
|
68
|
+
| icon | `ComponentType` | Icon component to display (mutually exclusive with image/illustration) | `-` |
|
|
69
|
+
| iconContainerVariant | `'subtle' \| 'emphasis'` | Icon container visual style | `'subtle'` |
|
|
70
|
+
| iconContainerSize | `'sm' \| 'md' \| 'lg'` | Icon container size | `'md'` |
|
|
71
|
+
| iconContainerColor | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Icon container color scheme | `'pig'` |
|
|
72
|
+
| illustration | `{ light: ImageSource, dark: ImageSource }` | Themed illustration object (mutually exclusive with icon/image) | `-` |
|
|
73
|
+
| image | `{ light: ImageSource, dark: ImageSource }` | Themed image object (mutually exclusive with icon/illustration) | `-` |
|
|
74
|
+
| heading | `string` | Heading text | `-` (required) |
|
|
75
|
+
| description | `string` | Description text | `-` (required) |
|
|
76
|
+
| direction | `'horizontal' \| 'vertical'` | Layout direction for icon/image and content | `'horizontal'` |
|
|
77
|
+
| link | `ReactNode` | Link element to display | `-` |
|
|
78
|
+
| button | `ReactNode` | Button element to display | `-` |
|
|
79
|
+
| onPress | `() => void` | Makes the entire banner pressable (shows chevron) | `-` |
|
|
80
|
+
| onClose | `() => void` | Shows close button with handler | `-` |
|
|
81
|
+
| variant | `'subtle' \| 'emphasis'` | Card visual style variant | `'subtle'` |
|
|
82
|
+
| colorScheme | `'pig' \| 'energy' \| 'broadband' \| 'mobile' \|` <br />`'insurance' \| 'cashback' \| 'highlight'` | Color scheme for buttons | `'pig'` |
|
|
83
|
+
|
|
84
|
+
The component also accepts all standard Card props except `noPadding`, `space`, `gap`, `rowGap`, `columnGap`, `flexDirection`, `flexWrap`, `alignItems`, and `justifyContent`.
|
|
85
|
+
|
|
86
|
+
## Layout Options
|
|
87
|
+
|
|
88
|
+
### Horizontal Layout (Default)
|
|
89
|
+
|
|
90
|
+
The default horizontal layout places the icon or image to the left of the content, creating a compact side-by-side arrangement.
|
|
91
|
+
|
|
92
|
+
```jsx
|
|
93
|
+
<Banner
|
|
94
|
+
icon={ElectricityMediumIcon}
|
|
95
|
+
heading="Horizontal Layout"
|
|
96
|
+
description="Icon appears to the left of the content."
|
|
97
|
+
direction="horizontal"
|
|
98
|
+
/>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Vertical Layout
|
|
102
|
+
|
|
103
|
+
The vertical layout stacks the icon or image above the content, useful for centered or full-width presentations.
|
|
104
|
+
|
|
105
|
+
```jsx
|
|
106
|
+
<Banner
|
|
107
|
+
icon={ElectricityMediumIcon}
|
|
108
|
+
heading="Vertical Layout"
|
|
109
|
+
description="Icon appears above the content."
|
|
110
|
+
direction="vertical"
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Examples
|
|
115
|
+
|
|
116
|
+
### With Icon
|
|
117
|
+
|
|
118
|
+
Use an icon with `IconContainer` styling options:
|
|
119
|
+
|
|
120
|
+
<Canvas of={Stories.WithIcon} />
|
|
121
|
+
|
|
122
|
+
```jsx
|
|
123
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
124
|
+
import {
|
|
125
|
+
ElectricityMediumIcon,
|
|
126
|
+
BroadbandMediumIcon,
|
|
127
|
+
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
128
|
+
|
|
129
|
+
const MyComponent = () => (
|
|
130
|
+
<>
|
|
131
|
+
<Banner
|
|
132
|
+
icon={ElectricityMediumIcon}
|
|
133
|
+
iconContainerColor="energy"
|
|
134
|
+
heading="Energy Services"
|
|
135
|
+
description="Manage your energy account and view your usage."
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
<Banner
|
|
139
|
+
icon={BroadbandMediumIcon}
|
|
140
|
+
iconContainerColor="broadband"
|
|
141
|
+
iconContainerVariant="emphasis"
|
|
142
|
+
heading="Broadband Plans"
|
|
143
|
+
description="Upgrade your broadband to faster speeds."
|
|
144
|
+
/>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### With Image
|
|
150
|
+
|
|
151
|
+
Display a themed image that automatically switches between light and dark modes:
|
|
152
|
+
|
|
153
|
+
<Canvas of={Stories.WithImage} />
|
|
154
|
+
|
|
155
|
+
```jsx
|
|
156
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
157
|
+
|
|
158
|
+
const MyComponent = () => (
|
|
159
|
+
<Banner
|
|
160
|
+
image={{
|
|
161
|
+
light: { uri: 'https://example.com/light-image.jpg' },
|
|
162
|
+
dark: { uri: 'https://example.com/dark-image.jpg' },
|
|
163
|
+
}}
|
|
164
|
+
heading="Featured Content"
|
|
165
|
+
description="Discover amazing content curated just for you."
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### With Illustration
|
|
171
|
+
|
|
172
|
+
Display a themed illustration that adapts to layout changes:
|
|
173
|
+
|
|
174
|
+
<Canvas of={Stories.WithIllustration} />
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
178
|
+
import SpotBillingDark from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-dark.svg';
|
|
179
|
+
import SpotBillingLight from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-light.svg';
|
|
180
|
+
|
|
181
|
+
const MyComponent = () => (
|
|
182
|
+
<Banner
|
|
183
|
+
illustration={{
|
|
184
|
+
light: SpotBillingLight,
|
|
185
|
+
dark: SpotBillingDark,
|
|
186
|
+
width: 80,
|
|
187
|
+
height: 80,
|
|
188
|
+
}}
|
|
189
|
+
heading="Featured Content"
|
|
190
|
+
description="Discover amazing content curated just for you."
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### With Button
|
|
196
|
+
|
|
197
|
+
Add a button for clear call-to-action:
|
|
198
|
+
|
|
199
|
+
<Canvas of={Stories.WithButton} />
|
|
200
|
+
|
|
201
|
+
```jsx
|
|
202
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
203
|
+
import { InsuranceMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
204
|
+
|
|
205
|
+
const MyComponent = () => (
|
|
206
|
+
<Banner
|
|
207
|
+
icon={InsuranceMediumIcon}
|
|
208
|
+
iconContainerColor="insurance"
|
|
209
|
+
heading="Home Insurance"
|
|
210
|
+
description="Protect your home with our comprehensive insurance."
|
|
211
|
+
button={
|
|
212
|
+
<Button size="sm" onPress={() => console.log('Get Quote pressed')}>
|
|
213
|
+
Get Quote
|
|
214
|
+
</Button>
|
|
215
|
+
}
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### With Link
|
|
221
|
+
|
|
222
|
+
Use a link for lighter-weight actions:
|
|
223
|
+
|
|
224
|
+
<Canvas of={Stories.WithLink} />
|
|
225
|
+
|
|
226
|
+
```jsx
|
|
227
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
228
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
229
|
+
|
|
230
|
+
const MyComponent = () => (
|
|
231
|
+
<Banner
|
|
232
|
+
icon={ElectricityMediumIcon}
|
|
233
|
+
iconContainerColor="energy"
|
|
234
|
+
heading="Energy Saving Tips"
|
|
235
|
+
description="Learn how to reduce your energy consumption."
|
|
236
|
+
link={<Link href="#">View tips</Link>}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Pressable
|
|
242
|
+
|
|
243
|
+
Make the entire banner pressable with a chevron indicator:
|
|
244
|
+
|
|
245
|
+
<Canvas of={Stories.Pressable} />
|
|
246
|
+
|
|
247
|
+
```jsx
|
|
248
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
249
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
250
|
+
|
|
251
|
+
const MyComponent = () => (
|
|
252
|
+
<Banner
|
|
253
|
+
icon={ElectricityMediumIcon}
|
|
254
|
+
iconContainerColor="energy"
|
|
255
|
+
heading="Energy Dashboard"
|
|
256
|
+
description="View your energy usage and bills."
|
|
257
|
+
onPress={() => console.log('Banner pressed')}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### With Close Button
|
|
263
|
+
|
|
264
|
+
Add a close button for dismissible banners:
|
|
265
|
+
|
|
266
|
+
<Canvas of={Stories.WithClose} />
|
|
267
|
+
|
|
268
|
+
```jsx
|
|
269
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
270
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
271
|
+
|
|
272
|
+
const MyComponent = () => (
|
|
273
|
+
<Banner
|
|
274
|
+
icon={ElectricityMediumIcon}
|
|
275
|
+
iconContainerColor="energy"
|
|
276
|
+
heading="Special Announcement"
|
|
277
|
+
description="We have some exciting news to share with you."
|
|
278
|
+
onClose={() => console.log('Close pressed')}
|
|
279
|
+
/>
|
|
280
|
+
);
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Vertical Layout
|
|
284
|
+
|
|
285
|
+
Stack the icon or image above the content:
|
|
286
|
+
|
|
287
|
+
<Canvas of={Stories.VerticalLayout} />
|
|
288
|
+
|
|
289
|
+
```jsx
|
|
290
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
291
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
292
|
+
|
|
293
|
+
const MyComponent = () => (
|
|
294
|
+
<Banner
|
|
295
|
+
icon={ElectricityMediumIcon}
|
|
296
|
+
iconContainerColor="energy"
|
|
297
|
+
heading="Energy Services"
|
|
298
|
+
description="Manage your energy account and view your usage."
|
|
299
|
+
direction="vertical"
|
|
300
|
+
/>
|
|
301
|
+
);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Color Schemes
|
|
305
|
+
|
|
306
|
+
The component supports semantic color schemes for buttons and theming:
|
|
307
|
+
|
|
308
|
+
<Canvas of={Stories.ColorSchemes} />
|
|
309
|
+
|
|
310
|
+
```jsx
|
|
311
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
312
|
+
import { ElectricityMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
313
|
+
|
|
314
|
+
const MyComponent = () => (
|
|
315
|
+
<>
|
|
316
|
+
<Banner
|
|
317
|
+
icon={ElectricityMediumIcon}
|
|
318
|
+
iconContainerColor="energy"
|
|
319
|
+
colorScheme="energy"
|
|
320
|
+
heading="Energy Blue"
|
|
321
|
+
description="Banner with energy color scheme."
|
|
322
|
+
button={
|
|
323
|
+
<Button size="sm" onPress={() => {}}>
|
|
324
|
+
Action
|
|
325
|
+
</Button>
|
|
326
|
+
}
|
|
327
|
+
/>
|
|
328
|
+
|
|
329
|
+
<Banner
|
|
330
|
+
icon={BroadbandMediumIcon}
|
|
331
|
+
iconContainerColor="broadband"
|
|
332
|
+
colorScheme="broadband"
|
|
333
|
+
heading="Broadband Green"
|
|
334
|
+
description="Banner with broadband color scheme."
|
|
335
|
+
button={
|
|
336
|
+
<Button size="sm" onPress={() => {}}>
|
|
337
|
+
Action
|
|
338
|
+
</Button>
|
|
339
|
+
}
|
|
340
|
+
/>
|
|
341
|
+
</>
|
|
342
|
+
);
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Complex Examples
|
|
346
|
+
|
|
347
|
+
Combine multiple features for rich interactive banners:
|
|
348
|
+
|
|
349
|
+
<Canvas of={Stories.ComplexExample} />
|
|
350
|
+
|
|
351
|
+
```jsx
|
|
352
|
+
import { Banner } from '@utilitywarehouse/hearth-react-native';
|
|
353
|
+
import { InsuranceMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
354
|
+
|
|
355
|
+
const MyComponent = () => (
|
|
356
|
+
<>
|
|
357
|
+
{/* Pressable banner with button */}
|
|
358
|
+
<Banner
|
|
359
|
+
icon={InsuranceMediumIcon}
|
|
360
|
+
iconContainerColor="insurance"
|
|
361
|
+
iconContainerVariant="emphasis"
|
|
362
|
+
colorScheme="insurance"
|
|
363
|
+
heading="Home Insurance Alert"
|
|
364
|
+
description="Your policy renewal is coming up. Review your coverage and make any necessary changes."
|
|
365
|
+
button={
|
|
366
|
+
<Button size="sm" onPress={() => console.log('Review pressed')}>
|
|
367
|
+
Review Policy
|
|
368
|
+
</Button>
|
|
369
|
+
}
|
|
370
|
+
onPress={() => console.log('Banner pressed')}
|
|
371
|
+
/>
|
|
372
|
+
|
|
373
|
+
{/* Dismissible banner with link */}
|
|
374
|
+
<Banner
|
|
375
|
+
image={{
|
|
376
|
+
light: { uri: 'https://example.com/light.jpg' },
|
|
377
|
+
dark: { uri: 'https://example.com/dark.jpg' },
|
|
378
|
+
}}
|
|
379
|
+
heading="Exclusive Member Benefit"
|
|
380
|
+
description="As a valued member, you now have access to premium features at no extra cost."
|
|
381
|
+
variant="emphasis"
|
|
382
|
+
link={<Link href="#">Explore benefits</Link>}
|
|
383
|
+
onClose={() => console.log('Close pressed')}
|
|
384
|
+
/>
|
|
385
|
+
</>
|
|
386
|
+
);
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Best Practices
|
|
390
|
+
|
|
391
|
+
- Use **icons** for service-related or informational banners
|
|
392
|
+
- Use **images** for promotional or visual content with fixed aspect ratios
|
|
393
|
+
- Use **illustrations** for decorative or branded visual content that adapts to layout
|
|
394
|
+
- Choose **horizontal layout** for compact presentations
|
|
395
|
+
- Choose **vertical layout** for more prominent or centered displays
|
|
396
|
+
- Use **pressable** (`onPress`) when the entire banner is clickable
|
|
397
|
+
- Use **buttons** for primary actions (e.g., "Get Started", "Learn More")
|
|
398
|
+
- Use **links** for secondary actions (e.g., "View details", "Read more")
|
|
399
|
+
- Add **close button** (`onClose`) for dismissible announcements or notifications
|
|
400
|
+
- Align **iconContainerColor** and **colorScheme** with your content's semantic meaning
|
|
401
|
+
- Don't combine icon, image, and illustration - they are mutually exclusive
|
|
402
|
+
- Avoid using both `onPress` and `onClose` together unless the distinction is clear to users
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement } from 'react';
|
|
2
|
+
import type { ImageSourcePropType } from 'react-native';
|
|
3
|
+
import type CardProps from '../Card/Card.props';
|
|
4
|
+
|
|
5
|
+
export type BannerDirection = 'horizontal' | 'vertical';
|
|
6
|
+
|
|
7
|
+
export interface BannerProps
|
|
8
|
+
extends Omit<
|
|
9
|
+
CardProps,
|
|
10
|
+
| 'noPadding'
|
|
11
|
+
| 'variant'
|
|
12
|
+
| 'colorScheme'
|
|
13
|
+
| 'space'
|
|
14
|
+
| 'gap'
|
|
15
|
+
| 'rowGap'
|
|
16
|
+
| 'columnGap'
|
|
17
|
+
| 'flexDirection'
|
|
18
|
+
| 'flexWrap'
|
|
19
|
+
| 'alignItems'
|
|
20
|
+
| 'justifyContent'
|
|
21
|
+
> {
|
|
22
|
+
/**
|
|
23
|
+
* Icon component to display in the banner
|
|
24
|
+
* Mutually exclusive with image
|
|
25
|
+
*/
|
|
26
|
+
icon?: ComponentType;
|
|
27
|
+
/**
|
|
28
|
+
* Icon container variant
|
|
29
|
+
* @default 'subtle'
|
|
30
|
+
*/
|
|
31
|
+
iconContainerVariant?: 'subtle' | 'emphasis';
|
|
32
|
+
/**
|
|
33
|
+
* Icon container size
|
|
34
|
+
* @default 'md'
|
|
35
|
+
*/
|
|
36
|
+
iconContainerSize?: 'sm' | 'md' | 'lg';
|
|
37
|
+
/**
|
|
38
|
+
* Icon container color
|
|
39
|
+
* @default 'pig'
|
|
40
|
+
*/
|
|
41
|
+
iconContainerColor?:
|
|
42
|
+
| 'pig'
|
|
43
|
+
| 'energy'
|
|
44
|
+
| 'broadband'
|
|
45
|
+
| 'mobile'
|
|
46
|
+
| 'insurance'
|
|
47
|
+
| 'cashback'
|
|
48
|
+
| 'highlight';
|
|
49
|
+
/**
|
|
50
|
+
* Illustration to display in the banner
|
|
51
|
+
* Mutually exclusive with icon and image
|
|
52
|
+
*/
|
|
53
|
+
illustration?: {
|
|
54
|
+
light: ImageSourcePropType | ReactElement | ComponentType;
|
|
55
|
+
dark: ImageSourcePropType | ReactElement | ComponentType;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Image to display in the banner
|
|
59
|
+
* Mutually exclusive with icon and illustration
|
|
60
|
+
*/
|
|
61
|
+
image?: {
|
|
62
|
+
light: ImageSourcePropType | ReactElement | ComponentType;
|
|
63
|
+
dark: ImageSourcePropType | ReactElement | ComponentType;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Heading text
|
|
67
|
+
*/
|
|
68
|
+
heading: string;
|
|
69
|
+
/**
|
|
70
|
+
* Description text
|
|
71
|
+
*/
|
|
72
|
+
description: string;
|
|
73
|
+
/**
|
|
74
|
+
* Layout direction for icon/image and content
|
|
75
|
+
* @default 'horizontal'
|
|
76
|
+
*/
|
|
77
|
+
direction?: BannerDirection;
|
|
78
|
+
/**
|
|
79
|
+
* Link element to display
|
|
80
|
+
*/
|
|
81
|
+
link?: ReactElement;
|
|
82
|
+
/**
|
|
83
|
+
* Button element to display
|
|
84
|
+
*/
|
|
85
|
+
button?: ReactElement;
|
|
86
|
+
/**
|
|
87
|
+
* Makes the entire banner pressable
|
|
88
|
+
*/
|
|
89
|
+
onPress?: () => void;
|
|
90
|
+
/**
|
|
91
|
+
* Close button handler
|
|
92
|
+
*/
|
|
93
|
+
onClose?: () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Card variant
|
|
96
|
+
* @default 'subtle'
|
|
97
|
+
*/
|
|
98
|
+
variant?: 'subtle' | 'emphasis';
|
|
99
|
+
/**
|
|
100
|
+
* Color scheme for the banner
|
|
101
|
+
* @default 'pig'
|
|
102
|
+
*/
|
|
103
|
+
colorScheme?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default BannerProps;
|