@@ -4,10 +4,14 @@ import {View} from 'react-native';
44import { useMemoizedLazyExpensifyIcons , useMemoizedLazyIllustrations } from '@hooks/useLazyAsset' ;
55import useLocalize from '@hooks/useLocalize' ;
66import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
7+ import useTheme from '@hooks/useTheme' ;
78import useThemeStyles from '@hooks/useThemeStyles' ;
89import BillingBanner from '@pages/settings/Subscription/CardSection/BillingBanner/BillingBanner' ;
10+ import CONST from '@src/CONST' ;
911import Badge from './Badge' ;
1012import Button from './Button' ;
13+ import Icon from './Icon' ;
14+ import { PressableWithoutFeedback } from './Pressable' ;
1115import Text from './Text' ;
1216
1317type AgentPromotionalBannerProps = {
@@ -38,6 +42,7 @@ type AgentPromotionalBannerProps = {
3842
3943function AgentPromotionalBanner ( { title, subtitle, onDismiss, dismissSentryLabel, ctaText, onCtaPress, ctaSentryLabel, style} : AgentPromotionalBannerProps ) {
4044 const styles = useThemeStyles ( ) ;
45+ const theme = useTheme ( ) ;
4146 const { translate} = useLocalize ( ) ;
4247 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
4348 const illustrations = useMemoizedLazyIllustrations ( [ 'AiBot' ] ) ;
@@ -63,33 +68,57 @@ function AgentPromotionalBanner({title, subtitle, onDismiss, dismissSentryLabel,
6368 [ title , styles , translate ] ,
6469 ) ;
6570
71+ const dismissIcon = useMemo (
72+ ( ) => (
73+ < PressableWithoutFeedback
74+ onPress = { onDismiss }
75+ style = { [ styles . touchableButtonImage ] }
76+ role = { CONST . ROLE . BUTTON }
77+ accessibilityLabel = { translate ( 'common.dismiss' ) }
78+ sentryLabel = { dismissSentryLabel }
79+ >
80+ < Icon
81+ src = { expensifyIcons . Close }
82+ fill = { theme . icon }
83+ />
84+ </ PressableWithoutFeedback >
85+ ) ,
86+ [ onDismiss , styles . touchableButtonImage , translate , dismissSentryLabel , expensifyIcons . Close , theme . icon ] ,
87+ ) ;
88+
6689 const rightComponent = useMemo ( ( ) => {
6790 if ( ! hasCta ) {
68- return null ;
91+ return dismissIcon ;
6992 }
7093 if ( shouldUseNarrowLayout ) {
7194 return (
72- < View style = { [ styles . flex0 , styles . flexBasis100 , styles . maxWidth100Percentage , styles . justifyContentCenter ] } >
73- < Button
74- success
75- medium
76- text = { ctaText }
77- onPress = { onCtaPress }
78- sentryLabel = { ctaSentryLabel }
79- />
80- </ View >
95+ < >
96+ { dismissIcon }
97+ < View style = { [ styles . flex0 , styles . flexBasis100 , styles . maxWidth100Percentage , styles . justifyContentCenter ] } >
98+ < Button
99+ success
100+ medium
101+ text = { ctaText }
102+ onPress = { onCtaPress }
103+ sentryLabel = { ctaSentryLabel }
104+ />
105+ </ View >
106+ </ >
81107 ) ;
82108 }
83109 return (
84- < Button
85- success
86- medium
87- text = { ctaText }
88- onPress = { onCtaPress }
89- sentryLabel = { ctaSentryLabel }
90- />
110+ < View style = { [ styles . flexRow , styles . gap4 , styles . alignItemsCenter ] } >
111+ < Button
112+ success
113+ medium
114+ text = { ctaText }
115+ onPress = { onCtaPress }
116+ sentryLabel = { ctaSentryLabel }
117+ />
118+ { dismissIcon }
119+ </ View >
91120 ) ;
92- } , [ hasCta , shouldUseNarrowLayout , ctaText , onCtaPress , ctaSentryLabel , styles ] ) ;
121+ } , [ hasCta , shouldUseNarrowLayout , ctaText , onCtaPress , ctaSentryLabel , styles , dismissIcon ] ) ;
93122
94123 return (
95124 < View style = { style } >
@@ -99,10 +128,6 @@ function AgentPromotionalBanner({title, subtitle, onDismiss, dismissSentryLabel,
99128 subtitle = { subtitle }
100129 subtitleStyle = { [ styles . mt1 , styles . textLabel ] }
101130 style = { [ styles . borderRadiusComponentLarge ] }
102- rightIcon = { expensifyIcons . Close }
103- onRightIconPress = { onDismiss }
104- rightIconAccessibilityLabel = { translate ( 'common.dismiss' ) }
105- rightIconSentryLabel = { dismissSentryLabel }
106131 rightComponent = { rightComponent }
107132 />
108133 </ View >
0 commit comments