File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { View , Text } from 'react-native' ;
2+
3+ import type { IterableEmbeddedComponentProps } from '../types/IterableEmbeddedComponentProps' ;
4+
5+ export const IterableEmbeddedBanner = ( {
6+ config,
7+ message,
8+ onButtonClick = ( ) => { } ,
9+ } : IterableEmbeddedComponentProps ) => {
10+ console . log ( `🚀 > IterableEmbeddedBanner > config:` , config ) ;
11+ console . log ( `🚀 > IterableEmbeddedBanner > message:` , message ) ;
12+ console . log ( `🚀 > IterableEmbeddedBanner > onButtonClick:` , onButtonClick ) ;
13+
14+ return (
15+ < View >
16+ < Text > IterableEmbeddedBanner</ Text >
17+ </ View >
18+ ) ;
19+ } ;
Original file line number Diff line number Diff line change 1+ import { View , Text } from 'react-native' ;
2+ import type { IterableEmbeddedComponentProps } from '../types/IterableEmbeddedComponentProps' ;
3+
4+ export const IterableEmbeddedCard = ( {
5+ config,
6+ message,
7+ onButtonClick = ( ) => { } ,
8+ } : IterableEmbeddedComponentProps ) => {
9+ console . log ( `🚀 > IterableEmbeddedCard > config:` , config ) ;
10+ console . log ( `🚀 > IterableEmbeddedCard > message:` , message ) ;
11+ console . log ( `🚀 > IterableEmbeddedCard > onButtonClick:` , onButtonClick ) ;
12+
13+ return (
14+ < View >
15+ < Text > IterableEmbeddedCard</ Text >
16+ </ View >
17+ ) ;
18+ } ;
Original file line number Diff line number Diff line change 1+ import { View , Text } from 'react-native' ;
2+
3+ import type { IterableEmbeddedComponentProps } from '../types/IterableEmbeddedComponentProps' ;
4+
5+ export const IterableEmbeddedNotification = ( {
6+ config,
7+ message,
8+ onButtonClick = ( ) => { } ,
9+ } : IterableEmbeddedComponentProps ) => {
10+ console . log ( `🚀 > IterableEmbeddedNotification > config:` , config ) ;
11+ console . log ( `🚀 > IterableEmbeddedNotification > message:` , message ) ;
12+ console . log (
13+ `🚀 > IterableEmbeddedNotification > onButtonClick:` ,
14+ onButtonClick
15+ ) ;
16+
17+ return (
18+ < View >
19+ < Text > IterableEmbeddedNotification</ Text >
20+ </ View >
21+ ) ;
22+ } ;
Original file line number Diff line number Diff line change 1+ import { useMemo } from 'react' ;
2+
3+ import { IterableEmbeddedViewType } from '../enums/IterableEmbeddedViewType' ;
4+
5+ import { IterableEmbeddedBanner } from './IterableEmbeddedBanner' ;
6+ import { IterableEmbeddedCard } from './IterableEmbeddedCard' ;
7+ import { IterableEmbeddedNotification } from './IterableEmbeddedNotification' ;
8+ import type { IterableEmbeddedComponentProps } from '../types/IterableEmbeddedComponentProps' ;
9+
10+ /**
11+ * The props for the IterableEmbeddedView component.
12+ */
13+ interface IterableEmbeddedViewProps extends IterableEmbeddedComponentProps {
14+ /** The type of view to render. */
15+ viewType : IterableEmbeddedViewType ;
16+ }
17+
18+ export const IterableEmbeddedView = ( {
19+ viewType,
20+ ...props
21+ } : IterableEmbeddedViewProps ) => {
22+ const Cmp = useMemo ( ( ) => {
23+ switch ( viewType ) {
24+ case IterableEmbeddedViewType . Card :
25+ return IterableEmbeddedCard ;
26+ case IterableEmbeddedViewType . Notification :
27+ return IterableEmbeddedNotification ;
28+ case IterableEmbeddedViewType . Banner :
29+ return IterableEmbeddedBanner ;
30+ default :
31+ return null ;
32+ }
33+ } , [ viewType ] ) ;
34+
35+ return Cmp ? < Cmp { ...props } /> : null ;
36+ } ;
Original file line number Diff line number Diff line change 1+ export * from './IterableEmbeddedBanner' ;
2+ export * from './IterableEmbeddedCard' ;
3+ export * from './IterableEmbeddedNotification' ;
4+ export * from './IterableEmbeddedView' ;
Original file line number Diff line number Diff line change 1+ /**
2+ * The view type for an embedded message.
3+ */
4+ export enum IterableEmbeddedViewType {
5+ /** The embedded view is a banner */
6+ Banner = 0 ,
7+ /** The embedded view is a card */
8+ Card = 1 ,
9+ /** The embedded view is a notification */
10+ Notification = 2 ,
11+ }
Original file line number Diff line number Diff line change 1+ export * from './IterableEmbeddedViewType' ;
Original file line number Diff line number Diff line change 1+ import type { IterableEmbeddedMessage } from './IterableEmbeddedMessage' ;
2+ import type { IterableEmbeddedMessageElementsButton } from './IterableEmbeddedMessageElementsButton' ;
3+ import type { IterableEmbeddedViewConfig } from './IterableEmbeddedViewConfig' ;
4+
5+ export interface IterableEmbeddedComponentProps {
6+ message : IterableEmbeddedMessage ;
7+ config ?: IterableEmbeddedViewConfig | null ;
8+ onButtonClick ?: ( button : IterableEmbeddedMessageElementsButton ) => void ;
9+ }
Original file line number Diff line number Diff line change 1+ import type { ColorValue } from 'react-native' ;
2+
3+ /**
4+ * Represents view-level styling configuration for an embedded view.
5+ */
6+ export interface IterableEmbeddedViewConfig {
7+ /** Background color hex (e.g., 0xFF0000) */
8+ backgroundColor ?: ColorValue ;
9+ /** Border color hex */
10+ borderColor ?: ColorValue ;
11+ /** Border width in pixels */
12+ borderWidth ?: number ;
13+ /** Corner radius in points */
14+ borderCornerRadius ?: number ;
15+ /** Primary button background color hex */
16+ primaryBtnBackgroundColor ?: ColorValue ;
17+ /** Primary button text color hex */
18+ primaryBtnTextColor ?: ColorValue ;
19+ /** Secondary button background color hex */
20+ secondaryBtnBackgroundColor ?: ColorValue ;
21+ /** Secondary button text color hex */
22+ secondaryBtnTextColor ?: ColorValue ;
23+ /** Title text color hex */
24+ titleTextColor ?: ColorValue ;
25+ /** Body text color hex */
26+ bodyTextColor ?: ColorValue ;
27+ }
Original file line number Diff line number Diff line change 1+ export * from './IterableEmbeddedComponentProps' ;
12export * from './IterableEmbeddedMessage' ;
23export * from './IterableEmbeddedMessageElements' ;
34export * from './IterableEmbeddedMessageElementsButton' ;
45export * from './IterableEmbeddedMessageElementsText' ;
56export * from './IterableEmbeddedMessageMetadata' ;
7+ export * from './IterableEmbeddedViewConfig' ;
You can’t perform that action at this time.
0 commit comments