@adobe/react-native-aepmessaging 7.2.1 → 7.4.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/RCTAEPMessaging.podspec +1 -1
- package/README.md +145 -16
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingConstants.java +3 -0
- package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingModule.java +103 -33
- package/babel.config.js +3 -0
- package/dist/module/Messaging.js +334 -0
- package/dist/module/Messaging.js.map +1 -0
- package/dist/module/index.js +30 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/models/ContentCard.js +24 -0
- package/dist/module/models/ContentCard.js.map +1 -0
- package/dist/{models → module/models}/HTMLProposition.js +8 -9
- package/dist/module/models/HTMLProposition.js.map +1 -0
- package/dist/module/models/InAppMessage.js +4 -0
- package/dist/module/models/InAppMessage.js.map +1 -0
- package/dist/module/models/JSONProposition.js +22 -0
- package/dist/module/models/JSONProposition.js.map +1 -0
- package/dist/module/models/Message.js +182 -0
- package/dist/module/models/Message.js.map +1 -0
- package/dist/module/models/MessagingDelegate.js +4 -0
- package/dist/module/models/MessagingDelegate.js.map +1 -0
- package/dist/module/models/MessagingEdgeEventType.js +24 -0
- package/dist/module/models/MessagingEdgeEventType.js.map +1 -0
- package/dist/module/models/MessagingProposition.js +57 -0
- package/dist/module/models/MessagingProposition.js.map +1 -0
- package/dist/module/models/MessagingPropositionItem.js +4 -0
- package/dist/module/models/MessagingPropositionItem.js.map +1 -0
- package/dist/module/models/PersonalizationSchema.js +26 -0
- package/dist/module/models/PersonalizationSchema.js.map +1 -0
- package/dist/module/models/PropositionItem.js +113 -0
- package/dist/module/models/PropositionItem.js.map +1 -0
- package/dist/module/models/ScopeDetails.js +2 -0
- package/dist/module/models/ScopeDetails.js.map +1 -0
- package/dist/{models/JSONProposition.js → module/models/index.js} +14 -12
- package/dist/module/models/index.js.map +1 -0
- package/dist/module/ui/components/Button/Button.js +57 -0
- package/dist/module/ui/components/Button/Button.js.map +1 -0
- package/dist/module/ui/components/Button/Button.spec.js +476 -0
- package/dist/module/ui/components/Button/Button.spec.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js +257 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.js.map +1 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js +363 -0
- package/dist/module/ui/components/ContentCardView/ContentCardView.spec.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js +70 -0
- package/dist/module/ui/components/DismissButton/DismissButton.js.map +1 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js +279 -0
- package/dist/module/ui/components/DismissButton/DismissButton.spec.js.map +1 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js +34 -0
- package/dist/module/ui/components/FullScreenCenterView/FullScreenCenterView.js.map +1 -0
- package/dist/module/ui/components/Inbox/EmptyState.js +64 -0
- package/dist/module/ui/components/Inbox/EmptyState.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.js +235 -0
- package/dist/module/ui/components/Inbox/Inbox.js.map +1 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js +847 -0
- package/dist/module/ui/components/Inbox/Inbox.spec.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.js +176 -0
- package/dist/module/ui/components/Pagination/Pagination.js.map +1 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js +193 -0
- package/dist/module/ui/components/Pagination/Pagination.spec.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js +184 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.js.map +1 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js +815 -0
- package/dist/module/ui/components/UnreadIcon/UnreadIcon.spec.js.map +1 -0
- package/dist/{models/ContentCard.js → module/ui/components/index.js} +12 -12
- package/dist/module/ui/components/index.js.map +1 -0
- package/dist/module/ui/hooks/index.js +18 -0
- package/dist/module/ui/hooks/index.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.js +33 -0
- package/dist/module/ui/hooks/useAspectRatio.js.map +1 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js +65 -0
- package/dist/module/ui/hooks/useAspectRatio.spec.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.js +51 -0
- package/dist/module/ui/hooks/useContentCardUI.js.map +1 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js +85 -0
- package/dist/module/ui/hooks/useContentCardUI.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.js +49 -0
- package/dist/module/ui/hooks/useInbox.js.map +1 -0
- package/dist/module/ui/hooks/useInbox.spec.js +93 -0
- package/dist/module/ui/hooks/useInbox.spec.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.js +26 -0
- package/dist/module/ui/hooks/useInboxSettings.js.map +1 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js +50 -0
- package/dist/module/ui/hooks/useInboxSettings.spec.js.map +1 -0
- package/dist/module/ui/index.js +10 -0
- package/dist/module/ui/index.js.map +1 -0
- package/dist/module/ui/providers/InboxProvider.js +27 -0
- package/dist/module/ui/providers/InboxProvider.js.map +1 -0
- package/dist/module/ui/theme/Theme.js +2 -0
- package/dist/module/ui/theme/Theme.js.map +1 -0
- package/dist/module/ui/theme/ThemeProvider.js +112 -0
- package/dist/module/ui/theme/ThemeProvider.js.map +1 -0
- package/dist/{models/InAppMessage.js → module/ui/theme/index.js} +6 -3
- package/dist/module/ui/theme/index.js.map +1 -0
- package/dist/module/ui/types/ContentViewEvent.js +2 -0
- package/dist/module/ui/types/ContentViewEvent.js.map +1 -0
- package/dist/module/ui/types/Templates.js +26 -0
- package/dist/module/ui/types/Templates.js.map +1 -0
- package/dist/{models/ScopeDetails.js → module/ui/types/index.js} +6 -3
- package/dist/module/ui/types/index.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.js +50 -0
- package/dist/module/ui/utils/generateCardHash.js.map +1 -0
- package/dist/module/ui/utils/generateCardHash.spec.js +103 -0
- package/dist/module/ui/utils/generateCardHash.spec.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.js +65 -0
- package/dist/module/ui/utils/inboxStorage.js.map +1 -0
- package/dist/module/ui/utils/inboxStorage.spec.js +123 -0
- package/dist/module/ui/utils/inboxStorage.spec.js.map +1 -0
- package/dist/module/ui/utils/index.js +5 -0
- package/dist/module/ui/utils/index.js.map +1 -0
- package/dist/{Messaging.d.ts → typescript/Messaging.d.ts} +23 -7
- package/dist/typescript/Messaging.d.ts.map +1 -0
- package/dist/{index.d.ts → typescript/index.d.ts} +4 -2
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/models/ContentCard.d.ts +57 -0
- package/dist/typescript/models/ContentCard.d.ts.map +1 -0
- package/dist/{models → typescript/models}/HTMLProposition.d.ts +1 -0
- package/dist/typescript/models/HTMLProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/InAppMessage.d.ts +1 -0
- package/dist/typescript/models/InAppMessage.d.ts.map +1 -0
- package/dist/{models → typescript/models}/JSONProposition.d.ts +1 -0
- package/dist/typescript/models/JSONProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/Message.d.ts +14 -0
- package/dist/typescript/models/Message.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingDelegate.d.ts +1 -0
- package/dist/typescript/models/MessagingDelegate.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingEdgeEventType.d.ts +1 -0
- package/dist/typescript/models/MessagingEdgeEventType.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingProposition.d.ts +1 -0
- package/dist/typescript/models/MessagingProposition.d.ts.map +1 -0
- package/dist/{models → typescript/models}/MessagingPropositionItem.d.ts +1 -0
- package/dist/typescript/models/MessagingPropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PersonalizationSchema.d.ts +2 -0
- package/dist/typescript/models/PersonalizationSchema.d.ts.map +1 -0
- package/dist/{models → typescript/models}/PropositionItem.d.ts +1 -0
- package/dist/typescript/models/PropositionItem.d.ts.map +1 -0
- package/dist/{models → typescript/models}/ScopeDetails.d.ts +1 -0
- package/dist/typescript/models/ScopeDetails.d.ts.map +1 -0
- package/dist/typescript/models/index.d.ts +11 -0
- package/dist/typescript/models/index.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.d.ts +14 -0
- package/dist/typescript/ui/components/Button/Button.d.ts.map +1 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Button/Button.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts +39 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.d.ts.map +1 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts +2 -0
- package/dist/typescript/ui/components/ContentCardView/ContentCardView.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts +13 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.d.ts.map +1 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts +2 -0
- package/dist/typescript/ui/components/DismissButton/DismissButton.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts +5 -0
- package/dist/typescript/ui/components/FullScreenCenterView/FullScreenCenterView.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts +19 -0
- package/dist/typescript/ui/components/Inbox/EmptyState.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts +21 -0
- package/dist/typescript/ui/components/Inbox/Inbox.d.ts.map +1 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Inbox/Inbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts +14 -0
- package/dist/typescript/ui/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts +2 -0
- package/dist/typescript/ui/components/Pagination/Pagination.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts +14 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.d.ts.map +1 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts +2 -0
- package/dist/typescript/ui/components/UnreadIcon/UnreadIcon.spec.d.ts.map +1 -0
- package/dist/typescript/ui/components/index.d.ts +10 -0
- package/dist/typescript/ui/components/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/index.d.ts +4 -0
- package/dist/typescript/ui/hooks/index.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts +3 -0
- package/dist/typescript/ui/hooks/useAspectRatio.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useAspectRatio.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts +14 -0
- package/dist/typescript/ui/hooks/useContentCardUI.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useContentCardUI.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts +12 -0
- package/dist/typescript/ui/hooks/useInbox.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInbox.spec.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts +7 -0
- package/dist/typescript/ui/hooks/useInboxSettings.d.ts.map +1 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts +2 -0
- package/dist/typescript/ui/hooks/useInboxSettings.spec.d.ts.map +1 -0
- package/dist/typescript/ui/index.d.ts +8 -0
- package/dist/typescript/ui/index.d.ts.map +1 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts +56 -0
- package/dist/typescript/ui/providers/InboxProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/Theme.d.ts +44 -0
- package/dist/typescript/ui/theme/Theme.d.ts.map +1 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts +21 -0
- package/dist/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/typescript/ui/theme/index.d.ts +3 -0
- package/dist/typescript/ui/theme/index.d.ts.map +1 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts +9 -0
- package/dist/typescript/ui/types/ContentViewEvent.d.ts.map +1 -0
- package/dist/typescript/ui/types/Templates.d.ts +43 -0
- package/dist/typescript/ui/types/Templates.d.ts.map +1 -0
- package/dist/typescript/ui/types/index.d.ts +3 -0
- package/dist/typescript/ui/types/index.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts +21 -0
- package/dist/typescript/ui/utils/generateCardHash.d.ts.map +1 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/generateCardHash.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts +20 -0
- package/dist/typescript/ui/utils/inboxStorage.d.ts.map +1 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts +2 -0
- package/dist/typescript/ui/utils/inboxStorage.spec.d.ts.map +1 -0
- package/dist/typescript/ui/utils/index.d.ts +3 -0
- package/dist/typescript/ui/utils/index.d.ts.map +1 -0
- package/ios/src/RCTAEPMessaging.mm +15 -0
- package/ios/src/RCTAEPMessaging.swift +61 -3
- package/ios/src/RCTAEPMessagingConstants.swift +4 -1
- package/jest.config.js +15 -0
- package/package.json +33 -5
- package/src/Messaging.ts +288 -32
- package/src/index.ts +3 -3
- package/src/models/ContentCard.ts +52 -27
- package/src/models/HTMLProposition.ts +1 -1
- package/src/models/JSONProposition.ts +1 -1
- package/src/models/Message.ts +50 -0
- package/src/models/PersonalizationSchema.ts +1 -0
- package/src/models/index.ts +22 -0
- package/src/ui/components/Button/Button.spec.tsx +496 -0
- package/src/ui/components/Button/Button.tsx +76 -0
- package/src/ui/components/ContentCardView/ContentCardView.spec.tsx +278 -0
- package/src/ui/components/ContentCardView/ContentCardView.tsx +400 -0
- package/src/ui/components/DismissButton/DismissButton.spec.tsx +314 -0
- package/src/ui/components/DismissButton/DismissButton.tsx +100 -0
- package/src/ui/components/FullScreenCenterView/FullScreenCenterView.tsx +32 -0
- package/src/ui/components/Inbox/EmptyState.tsx +89 -0
- package/src/ui/components/Inbox/Inbox.spec.tsx +478 -0
- package/src/ui/components/Inbox/Inbox.tsx +275 -0
- package/src/ui/components/Pagination/Pagination.spec.tsx +159 -0
- package/src/ui/components/Pagination/Pagination.tsx +222 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.spec.tsx +878 -0
- package/src/ui/components/UnreadIcon/UnreadIcon.tsx +234 -0
- package/src/ui/components/index.ts +22 -0
- package/{dist/models/MessagingPropositionItem.js → src/ui/hooks/index.ts} +5 -4
- package/src/ui/hooks/useAspectRatio.spec.tsx +66 -0
- package/src/ui/hooks/useAspectRatio.tsx +39 -0
- package/src/ui/hooks/useContentCardUI.spec.tsx +82 -0
- package/src/ui/hooks/useContentCardUI.ts +48 -0
- package/src/ui/hooks/useInbox.spec.tsx +87 -0
- package/src/ui/hooks/useInbox.ts +46 -0
- package/src/ui/hooks/useInboxSettings.spec.tsx +41 -0
- package/src/ui/hooks/useInboxSettings.ts +24 -0
- package/src/ui/index.ts +7 -0
- package/src/ui/providers/InboxProvider.tsx +79 -0
- package/src/ui/theme/Theme.ts +57 -0
- package/src/ui/theme/ThemeProvider.tsx +120 -0
- package/src/ui/theme/index.ts +14 -0
- package/src/ui/types/ContentViewEvent.ts +20 -0
- package/src/ui/types/Templates.ts +77 -0
- package/src/ui/types/index.ts +14 -0
- package/src/ui/utils/generateCardHash.spec.tsx +86 -0
- package/src/ui/utils/generateCardHash.ts +59 -0
- package/src/ui/utils/inboxStorage.spec.tsx +136 -0
- package/src/ui/utils/inboxStorage.ts +64 -0
- package/src/ui/utils/index.ts +3 -0
- package/tutorials/ContentCardCustomizationGuide.md +661 -0
- package/tutorials/ContentCards.md +419 -0
- package/tutorials/In-App Messaging.md +31 -0
- package/tutorials/Inbox.md +515 -0
- package/tutorials/resources/image-only-template.png +0 -0
- package/tutorials/resources/large-image-template.png +0 -0
- package/tutorials/resources/small-image-template.png +0 -0
- package/dist/Messaging.js +0 -151
- package/dist/Messaging.js.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/models/ContentCard.d.ts +0 -51
- package/dist/models/ContentCard.js.map +0 -1
- package/dist/models/HTMLProposition.js.map +0 -1
- package/dist/models/InAppMessage.js.map +0 -1
- package/dist/models/JSONProposition.js.map +0 -1
- package/dist/models/Message.js +0 -114
- package/dist/models/Message.js.map +0 -1
- package/dist/models/MessagingDelegate.js +0 -14
- package/dist/models/MessagingDelegate.js.map +0 -1
- package/dist/models/MessagingEdgeEventType.js +0 -24
- package/dist/models/MessagingEdgeEventType.js.map +0 -1
- package/dist/models/MessagingProposition.js +0 -59
- package/dist/models/MessagingProposition.js.map +0 -1
- package/dist/models/MessagingPropositionItem.js.map +0 -1
- package/dist/models/PersonalizationSchema.js +0 -25
- package/dist/models/PersonalizationSchema.js.map +0 -1
- package/dist/models/PropositionItem.js +0 -78
- package/dist/models/PropositionItem.js.map +0 -1
- package/dist/models/ScopeDetails.js.map +0 -1
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
# Content Card Customization Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Adobe Experience Platform (AEP) React Native Messaging SDK provides a comprehensive and flexible content card system with multiple levels of customization. This guide explains how to customize content cards using the three-tier hierarchy: **Theme → Style Overrides → Props**.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Customization Hierarchy](#customization-hierarchy)
|
|
10
|
+
2. [Theme System](#theme-system)
|
|
11
|
+
3. [Style Overrides](#style-overrides)
|
|
12
|
+
4. [Component Props](#component-props)
|
|
13
|
+
5. [Practical Example](#practical-example)
|
|
14
|
+
6. [Best Practices](#best-practices)
|
|
15
|
+
7. [Troubleshooting](#troubleshooting)
|
|
16
|
+
|
|
17
|
+
## Customization Hierarchy
|
|
18
|
+
|
|
19
|
+
The content card customization follows a clear hierarchy where each level can override the previous one:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Theme (Global) → Style Overrides (Component-specific) → Props (Element-specific)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Priority Order (Highest to Lowest)
|
|
26
|
+
1. **Props** - Most specific, overrides everything
|
|
27
|
+
2. **Style Overrides** - Component-level customization
|
|
28
|
+
3. **Theme** - Global application-wide styling
|
|
29
|
+
4. **Default Styles** - Built-in component styles
|
|
30
|
+
|
|
31
|
+
### How the Hierarchy Works
|
|
32
|
+
|
|
33
|
+
Each level in the hierarchy can override properties from levels below it:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// Example: Text color resolution
|
|
37
|
+
const finalTextColor =
|
|
38
|
+
titleProps?.style?.color || // 1. Props (highest priority)
|
|
39
|
+
styleOverrides?.title?.color || // 2. Style Overrides
|
|
40
|
+
theme.colors.textPrimary || // 3. Theme
|
|
41
|
+
defaultStyles.title.color; // 4. Default (lowest priority)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This means you can set a global brand color in your theme, override it for specific components with style overrides, and further customize individual elements with props when needed.
|
|
45
|
+
|
|
46
|
+
## Theme System
|
|
47
|
+
|
|
48
|
+
### Basic Theme Setup
|
|
49
|
+
|
|
50
|
+
The theme system provides global styling for all content cards with automatic light/dark mode support.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { ThemeProvider, Themes } from '@adobe/react-native-aepmessaging';
|
|
54
|
+
|
|
55
|
+
const customThemes: Themes = {
|
|
56
|
+
light: {
|
|
57
|
+
colors: {
|
|
58
|
+
primary: '#007AFF', // Brand primary color
|
|
59
|
+
secondary: '#5856D6', // Secondary accent color
|
|
60
|
+
background: '#FFFFFF', // Card background
|
|
61
|
+
textPrimary: '#000000', // Main text color
|
|
62
|
+
textSecondary: '#8E8E93', // Secondary text color
|
|
63
|
+
imagePlaceholder: '#C7C7CC', // Image loading placeholder
|
|
64
|
+
buttonTextColor: 'dodgerblue' // Button text color
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
dark: {
|
|
68
|
+
colors: {
|
|
69
|
+
primary: '#0A84FF',
|
|
70
|
+
secondary: '#5E5CE6',
|
|
71
|
+
background: '#262626',
|
|
72
|
+
textPrimary: '#FFFFFF',
|
|
73
|
+
textSecondary: '#8E8E93',
|
|
74
|
+
imagePlaceholder: '#48484A',
|
|
75
|
+
buttonTextColor: 'dodgerblue'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function App() {
|
|
81
|
+
return (
|
|
82
|
+
<ThemeProvider customThemes={customThemes}>
|
|
83
|
+
{/* Your app content */}
|
|
84
|
+
</ThemeProvider>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Available Theme Colors
|
|
90
|
+
|
|
91
|
+
The following colors can be customized in your theme:
|
|
92
|
+
|
|
93
|
+
| Color Property | Description | Usage |
|
|
94
|
+
|----------------|-------------|--------|
|
|
95
|
+
| `background` | Card background color | All card templates |
|
|
96
|
+
| `textPrimary` | Main text content | Title and body text |
|
|
97
|
+
| `imagePlaceholder` | Image loading state | Placeholder while images load |
|
|
98
|
+
| `buttonTextColor` | Button text color | Action button text |
|
|
99
|
+
|
|
100
|
+
**Example:**
|
|
101
|
+
```typescript
|
|
102
|
+
const myBrandTheme = {
|
|
103
|
+
light: {
|
|
104
|
+
colors: {
|
|
105
|
+
background: '#FFFFFF',
|
|
106
|
+
textPrimary: '#1A1A1A',
|
|
107
|
+
imagePlaceholder: '#E5E5E5',
|
|
108
|
+
buttonTextColor: '#007AFF'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Style Overrides
|
|
115
|
+
|
|
116
|
+
Style overrides provide component-level customization for each template type. They follow React Native's `StyleSheet` patterns.
|
|
117
|
+
|
|
118
|
+
### SmallImageCard Style Overrides
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { SmallImageContentStyle } from '@adobe/react-native-aepmessaging';
|
|
122
|
+
|
|
123
|
+
const smallImageStyleOverrides: SmallImageContentStyle = {
|
|
124
|
+
// Root card container
|
|
125
|
+
card: {
|
|
126
|
+
borderRadius: 16,
|
|
127
|
+
margin: 20,
|
|
128
|
+
backgroundColor: '#f8f9fa',
|
|
129
|
+
shadowColor: '#000',
|
|
130
|
+
shadowOffset: { width: 0, height: 2 },
|
|
131
|
+
shadowOpacity: 0.1,
|
|
132
|
+
shadowRadius: 4,
|
|
133
|
+
elevation: 3
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// Inner container
|
|
137
|
+
container: {
|
|
138
|
+
padding: 16,
|
|
139
|
+
flexDirection: 'row'
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
// Image container
|
|
143
|
+
imageContainer: {
|
|
144
|
+
borderRadius: 12,
|
|
145
|
+
overflow: 'hidden',
|
|
146
|
+
marginRight: 12
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
// Image styling
|
|
150
|
+
image: {
|
|
151
|
+
width: 80,
|
|
152
|
+
height: 80
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
// Content area
|
|
156
|
+
contentContainer: {
|
|
157
|
+
flex: 1,
|
|
158
|
+
justifyContent: 'space-between'
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
// Text styling (applies to both title and body)
|
|
162
|
+
text: {
|
|
163
|
+
fontFamily: 'YourCustomFont-Regular'
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// Title-specific styling
|
|
167
|
+
title: {
|
|
168
|
+
fontSize: 18,
|
|
169
|
+
fontWeight: '700',
|
|
170
|
+
color: '#1a1a1a',
|
|
171
|
+
marginBottom: 4
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
// Body text styling
|
|
175
|
+
body: {
|
|
176
|
+
fontSize: 14,
|
|
177
|
+
lineHeight: 20,
|
|
178
|
+
color: '#666666'
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
// Button container
|
|
182
|
+
buttonContainer: {
|
|
183
|
+
flexDirection: 'row',
|
|
184
|
+
marginTop: 12,
|
|
185
|
+
gap: 8
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
// Individual button styling
|
|
189
|
+
button: {
|
|
190
|
+
backgroundColor: '#007AFF',
|
|
191
|
+
paddingHorizontal: 16,
|
|
192
|
+
paddingVertical: 8,
|
|
193
|
+
borderRadius: 8
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
// Button text styling
|
|
197
|
+
buttonText: {
|
|
198
|
+
color: '#FFFFFF',
|
|
199
|
+
fontWeight: '600'
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
// Dismiss button styling
|
|
203
|
+
dismissButton: {
|
|
204
|
+
backgroundColor: 'rgba(0,0,0,0.1)',
|
|
205
|
+
width: 24,
|
|
206
|
+
height: 24,
|
|
207
|
+
borderRadius: 12
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### LargeImageCard Style Overrides
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { LargeImageContentStyle } from '@adobe/react-native-aepmessaging';
|
|
216
|
+
|
|
217
|
+
const largeImageStyleOverrides: LargeImageContentStyle = {
|
|
218
|
+
// Root card container
|
|
219
|
+
card: {
|
|
220
|
+
borderRadius: 20,
|
|
221
|
+
margin: 16,
|
|
222
|
+
backgroundColor: '#ffffff',
|
|
223
|
+
overflow: 'hidden'
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
// Main container
|
|
227
|
+
container: {
|
|
228
|
+
flexDirection: 'column'
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
// Image container (top section)
|
|
232
|
+
imageContainer: {
|
|
233
|
+
height: 200,
|
|
234
|
+
position: 'relative'
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
// Image styling
|
|
238
|
+
image: {
|
|
239
|
+
width: '100%',
|
|
240
|
+
height: '100%',
|
|
241
|
+
resizeMode: 'cover'
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
// Content area (below image)
|
|
245
|
+
contentContainer: {
|
|
246
|
+
padding: 20
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
// Text content wrapper
|
|
250
|
+
textContent: {
|
|
251
|
+
marginBottom: 16
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// Title styling
|
|
255
|
+
title: {
|
|
256
|
+
fontSize: 24,
|
|
257
|
+
fontWeight: '800',
|
|
258
|
+
color: '#1a1a1a',
|
|
259
|
+
marginBottom: 8
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// Body text styling
|
|
263
|
+
body: {
|
|
264
|
+
fontSize: 16,
|
|
265
|
+
lineHeight: 24,
|
|
266
|
+
color: '#4a4a4a'
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
// Button container
|
|
270
|
+
buttonContainer: {
|
|
271
|
+
flexDirection: 'row',
|
|
272
|
+
justifyContent: 'space-between'
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
// Button styling
|
|
276
|
+
button: {
|
|
277
|
+
flex: 1,
|
|
278
|
+
backgroundColor: '#007AFF',
|
|
279
|
+
paddingVertical: 12,
|
|
280
|
+
borderRadius: 12,
|
|
281
|
+
marginHorizontal: 4
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// Button text
|
|
285
|
+
buttonText: {
|
|
286
|
+
color: '#FFFFFF',
|
|
287
|
+
fontSize: 16,
|
|
288
|
+
fontWeight: '600',
|
|
289
|
+
textAlign: 'center'
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### ImageOnlyCard Style Overrides
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { ImageOnlyContentStyle } from '@adobe/react-native-aepmessaging';
|
|
298
|
+
|
|
299
|
+
const imageOnlyStyleOverrides: ImageOnlyContentStyle = {
|
|
300
|
+
// Root card container
|
|
301
|
+
card: {
|
|
302
|
+
borderRadius: 16,
|
|
303
|
+
margin: 12,
|
|
304
|
+
overflow: 'hidden'
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
// Image container
|
|
308
|
+
imageContainer: {
|
|
309
|
+
backgroundColor: '#f0f0f0',
|
|
310
|
+
position: 'relative'
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
// Image styling
|
|
314
|
+
image: {
|
|
315
|
+
width: '100%',
|
|
316
|
+
height: 300,
|
|
317
|
+
resizeMode: 'cover'
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
// Dismiss button (overlaid on image)
|
|
321
|
+
dismissButton: {
|
|
322
|
+
position: 'absolute',
|
|
323
|
+
top: 8,
|
|
324
|
+
right: 8,
|
|
325
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
326
|
+
width: 28,
|
|
327
|
+
height: 28,
|
|
328
|
+
borderRadius: 14
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Component Props
|
|
334
|
+
|
|
335
|
+
For advanced customization, some components accept additional props that provide element-level control.
|
|
336
|
+
|
|
337
|
+
### SmallImageCard Props
|
|
338
|
+
|
|
339
|
+
The `SmallImageCard` component extends React Native's `PressableProps` and supports the following specific props:
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
import { SmallImageCard } from '@adobe/react-native-aepmessaging';
|
|
343
|
+
|
|
344
|
+
<SmallImageCard
|
|
345
|
+
content={contentData}
|
|
346
|
+
imageUri={imageUrl}
|
|
347
|
+
height={120} // Optional: Custom height for the card
|
|
348
|
+
styleOverrides={smallImageStyleOverrides}
|
|
349
|
+
onPress={handlePress}
|
|
350
|
+
onDismiss={handleDismiss}
|
|
351
|
+
|
|
352
|
+
// Standard PressableProps are also supported
|
|
353
|
+
accessibilityLabel="Product promotion card"
|
|
354
|
+
accessibilityRole="button"
|
|
355
|
+
accessibilityHint="Double tap to view product details"
|
|
356
|
+
disabled={false}
|
|
357
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
358
|
+
|
|
359
|
+
// Custom style function for press states
|
|
360
|
+
style={({ pressed }) => [
|
|
361
|
+
baseCardStyle,
|
|
362
|
+
pressed && { opacity: 0.8 }
|
|
363
|
+
]}
|
|
364
|
+
/>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Note**: `SmallImageCard` supports granular component props (like `ImageProps`, `TextProps`, `ButtonProps`) via the `ComponentOverrideProps` interface, similar to `LargeImageCard` and `ImageOnlyCard`. You can use both these props and `styleOverrides` for comprehensive customization.
|
|
368
|
+
|
|
369
|
+
#### SmallImageCard Advanced Props Example
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
import { SmallImageCard } from '@adobe/react-native-aepmessaging';
|
|
373
|
+
|
|
374
|
+
<SmallImageCard
|
|
375
|
+
content={contentData}
|
|
376
|
+
imageUri={imageUrl}
|
|
377
|
+
height={120}
|
|
378
|
+
styleOverrides={smallImageStyleOverrides}
|
|
379
|
+
onPress={handlePress}
|
|
380
|
+
onDismiss={handleDismiss}
|
|
381
|
+
|
|
382
|
+
// Advanced component props
|
|
383
|
+
ContainerProps={{
|
|
384
|
+
accessibilityLabel: 'Product promotion card'
|
|
385
|
+
}}
|
|
386
|
+
|
|
387
|
+
ImageContainerProps={{
|
|
388
|
+
accessibilityRole: 'image'
|
|
389
|
+
}}
|
|
390
|
+
|
|
391
|
+
ImageProps={{
|
|
392
|
+
accessibilityLabel: 'Product image',
|
|
393
|
+
resizeMode: 'cover'
|
|
394
|
+
}}
|
|
395
|
+
|
|
396
|
+
TextProps={{
|
|
397
|
+
accessibilityRole: 'text',
|
|
398
|
+
maxFontSizeMultiplier: 1.2
|
|
399
|
+
}}
|
|
400
|
+
|
|
401
|
+
TitleProps={{
|
|
402
|
+
numberOfLines: 1,
|
|
403
|
+
ellipsizeMode: 'tail'
|
|
404
|
+
}}
|
|
405
|
+
|
|
406
|
+
BodyProps={{
|
|
407
|
+
numberOfLines: 2,
|
|
408
|
+
ellipsizeMode: 'tail'
|
|
409
|
+
}}
|
|
410
|
+
|
|
411
|
+
ButtonContainerProps={{
|
|
412
|
+
accessibilityRole: 'button'
|
|
413
|
+
}}
|
|
414
|
+
|
|
415
|
+
ButtonProps={{
|
|
416
|
+
accessibilityHint: 'Double tap to learn more'
|
|
417
|
+
}}
|
|
418
|
+
|
|
419
|
+
DismissButtonProps={{
|
|
420
|
+
accessibilityLabel: 'Dismiss this card',
|
|
421
|
+
accessibilityHint: 'Double tap to close'
|
|
422
|
+
}}
|
|
423
|
+
|
|
424
|
+
// Standard PressableProps are also supported
|
|
425
|
+
accessibilityLabel="Product promotion card"
|
|
426
|
+
accessibilityRole="button"
|
|
427
|
+
disabled={false}
|
|
428
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
429
|
+
|
|
430
|
+
// Custom style function for press states
|
|
431
|
+
style={({ pressed }) => [
|
|
432
|
+
baseCardStyle,
|
|
433
|
+
pressed && { opacity: 0.8 }
|
|
434
|
+
]}
|
|
435
|
+
/>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### LargeImageCard Advanced Props
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
import { LargeImageCard } from '@adobe/react-native-aepmessaging';
|
|
442
|
+
|
|
443
|
+
<LargeImageCard
|
|
444
|
+
content={contentData}
|
|
445
|
+
imageUri={imageUrl}
|
|
446
|
+
styleOverrides={largeImageStyleOverrides}
|
|
447
|
+
onPress={handlePress}
|
|
448
|
+
onDismiss={handleDismiss}
|
|
449
|
+
|
|
450
|
+
// Advanced component props
|
|
451
|
+
ContainerProps={{
|
|
452
|
+
accessibilityLabel: 'Product promotion card'
|
|
453
|
+
}}
|
|
454
|
+
|
|
455
|
+
ImageContainerProps={{
|
|
456
|
+
accessibilityRole: 'image'
|
|
457
|
+
}}
|
|
458
|
+
|
|
459
|
+
ImageProps={{
|
|
460
|
+
accessibilityLabel: 'Product image',
|
|
461
|
+
resizeMode: 'cover'
|
|
462
|
+
}}
|
|
463
|
+
|
|
464
|
+
TextProps={{
|
|
465
|
+
accessibilityRole: 'text',
|
|
466
|
+
maxFontSizeMultiplier: 1.2
|
|
467
|
+
}}
|
|
468
|
+
|
|
469
|
+
TitleProps={{
|
|
470
|
+
numberOfLines: 2,
|
|
471
|
+
ellipsizeMode: 'tail'
|
|
472
|
+
}}
|
|
473
|
+
|
|
474
|
+
BodyProps={{
|
|
475
|
+
numberOfLines: 3,
|
|
476
|
+
ellipsizeMode: 'tail'
|
|
477
|
+
}}
|
|
478
|
+
|
|
479
|
+
ButtonContainerProps={{
|
|
480
|
+
accessibilityRole: 'button'
|
|
481
|
+
}}
|
|
482
|
+
|
|
483
|
+
ButtonProps={{
|
|
484
|
+
accessibilityHint: 'Double tap to learn more'
|
|
485
|
+
}}
|
|
486
|
+
|
|
487
|
+
DismissButtonProps={{
|
|
488
|
+
accessibilityLabel: 'Dismiss this card',
|
|
489
|
+
accessibilityHint: 'Double tap to close'
|
|
490
|
+
}}
|
|
491
|
+
/>
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### ImageOnlyCard Advanced Props
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
import { ImageOnlyCard } from '@adobe/react-native-aepmessaging';
|
|
498
|
+
|
|
499
|
+
<ImageOnlyCard
|
|
500
|
+
content={contentData}
|
|
501
|
+
imageUri={imageUrl}
|
|
502
|
+
styleOverrides={imageOnlyStyleOverrides}
|
|
503
|
+
onPress={handlePress}
|
|
504
|
+
onDismiss={handleDismiss}
|
|
505
|
+
|
|
506
|
+
// Advanced component props
|
|
507
|
+
ContainerProps={{
|
|
508
|
+
accessibilityLabel: 'Featured image card'
|
|
509
|
+
}}
|
|
510
|
+
|
|
511
|
+
ImageContainerProps={{
|
|
512
|
+
accessibilityRole: 'image'
|
|
513
|
+
}}
|
|
514
|
+
|
|
515
|
+
ImageProps={{
|
|
516
|
+
accessibilityLabel: 'Featured content image',
|
|
517
|
+
resizeMode: 'contain'
|
|
518
|
+
}}
|
|
519
|
+
|
|
520
|
+
DismissButtonProps={{
|
|
521
|
+
accessibilityLabel: 'Close image',
|
|
522
|
+
accessibilityHint: 'Double tap to dismiss'
|
|
523
|
+
}}
|
|
524
|
+
/>
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
## Practical Example
|
|
528
|
+
|
|
529
|
+
### E-commerce Product Card
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
import React from 'react';
|
|
533
|
+
import { ContentCardView, ThemeProvider } from '@adobe/react-native-aepmessaging';
|
|
534
|
+
|
|
535
|
+
// Custom theme for e-commerce
|
|
536
|
+
const ecommerceTheme = {
|
|
537
|
+
light: {
|
|
538
|
+
colors: {
|
|
539
|
+
primary: '#FF6B35',
|
|
540
|
+
secondary: '#004E89',
|
|
541
|
+
background: '#FFFFFF',
|
|
542
|
+
textPrimary: '#1A1A1A',
|
|
543
|
+
textSecondary: '#666666',
|
|
544
|
+
imagePlaceholder: '#E5E5E5',
|
|
545
|
+
buttonTextColor: '#FFFFFF'
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
dark: {
|
|
549
|
+
colors: {
|
|
550
|
+
primary: '#FF8A5B',
|
|
551
|
+
secondary: '#0066CC',
|
|
552
|
+
background: '#1A1A1A',
|
|
553
|
+
textPrimary: '#FFFFFF',
|
|
554
|
+
textSecondary: '#CCCCCC',
|
|
555
|
+
imagePlaceholder: '#333333',
|
|
556
|
+
buttonTextColor: 'dodgerblue'
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// Product card style overrides
|
|
562
|
+
const productCardStyles = {
|
|
563
|
+
smallImageStyle: {
|
|
564
|
+
card: {
|
|
565
|
+
borderRadius: 12,
|
|
566
|
+
backgroundColor: '#FFFFFF',
|
|
567
|
+
borderWidth: 1,
|
|
568
|
+
borderColor: '#E0E0E0',
|
|
569
|
+
margin: 16,
|
|
570
|
+
shadowColor: '#000',
|
|
571
|
+
shadowOffset: { width: 0, height: 2 },
|
|
572
|
+
shadowOpacity: 0.1,
|
|
573
|
+
shadowRadius: 4,
|
|
574
|
+
elevation: 3
|
|
575
|
+
},
|
|
576
|
+
image: {
|
|
577
|
+
borderRadius: 8
|
|
578
|
+
},
|
|
579
|
+
title: {
|
|
580
|
+
fontSize: 16,
|
|
581
|
+
fontWeight: '600',
|
|
582
|
+
color: '#1A1A1A'
|
|
583
|
+
},
|
|
584
|
+
body: {
|
|
585
|
+
fontSize: 14,
|
|
586
|
+
color: '#666666',
|
|
587
|
+
marginTop: 4
|
|
588
|
+
},
|
|
589
|
+
button: {
|
|
590
|
+
backgroundColor: '#FF6B35',
|
|
591
|
+
paddingHorizontal: 20,
|
|
592
|
+
paddingVertical: 10,
|
|
593
|
+
borderRadius: 25
|
|
594
|
+
},
|
|
595
|
+
buttonText: {
|
|
596
|
+
color: '#FFFFFF',
|
|
597
|
+
fontWeight: '600',
|
|
598
|
+
fontSize: 14
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
function ProductCard({ template }) {
|
|
604
|
+
const handleInteraction = (event, data) => {
|
|
605
|
+
console.log('Product card interaction:', event, data);
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
return (
|
|
609
|
+
<ThemeProvider customThemes={ecommerceTheme}>
|
|
610
|
+
<ContentCardView
|
|
611
|
+
template={template}
|
|
612
|
+
styleOverrides={productCardStyles}
|
|
613
|
+
listener={handleInteraction}
|
|
614
|
+
/>
|
|
615
|
+
</ThemeProvider>
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
## Best Practices
|
|
621
|
+
|
|
622
|
+
### 1. Hierarchy Best Practices
|
|
623
|
+
```typescript
|
|
624
|
+
// Good: Use hierarchy effectively
|
|
625
|
+
const styles = {
|
|
626
|
+
card: {
|
|
627
|
+
// Base card styling
|
|
628
|
+
backgroundColor: theme.colors.background, // Theme value
|
|
629
|
+
padding: 16, // Component-specific override
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// Good: Specific overrides
|
|
634
|
+
<SmallImageCard
|
|
635
|
+
styleOverrides={{
|
|
636
|
+
title: { fontSize: 18 }, // Override specific element
|
|
637
|
+
button: { backgroundColor: '#FF6B35' } // Brand-specific button color
|
|
638
|
+
}}
|
|
639
|
+
/>
|
|
640
|
+
|
|
641
|
+
// Avoid: Over-styling at theme level
|
|
642
|
+
const badTheme = {
|
|
643
|
+
colors: {
|
|
644
|
+
buttonSpecificBackgroundForProductCards: '#FF6B35' // Too specific for theme
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### 2. Consistent Theming
|
|
650
|
+
- Use the theme system for colors that should be consistent across all content cards
|
|
651
|
+
- Always provide both light and dark theme variants
|
|
652
|
+
- Test your themes in both color schemes
|
|
653
|
+
|
|
654
|
+
### 3. Responsive Design
|
|
655
|
+
- Use flexible layouts and relative sizing
|
|
656
|
+
- Test on different screen sizes and orientations
|
|
657
|
+
- Consider accessibility font scaling
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
This guide provides a comprehensive overview of the Content Card customization system. With the three-tier customization hierarchy (Theme → Style Overrides → Props), you can create beautiful, branded content cards that fit seamlessly into your app's design system.
|