@@ -14,8 +14,11 @@ import CrownShining from '../../UI/CustomSvgIcons/CrownShining';
14
14
import { useResponsiveWindowSize } from '../../UI/Responsive/ResponsiveWindowMeasurer' ;
15
15
import AuthenticatedUserContext from '../AuthenticatedUserContext' ;
16
16
import { hasValidSubscriptionPlan } from '../../Utils/GDevelopServices/Usage' ;
17
+ import IconButton from '../../UI/IconButton' ;
18
+ import Cross from '../../UI/CustomSvgIcons/Cross' ;
17
19
18
20
const styles = {
21
+ topRightHideButton : { position : 'absolute' , right : 1 , top : 1 } ,
19
22
paper : {
20
23
zIndex : 2 , // Make sure the paper is above the background for the border effect.
21
24
flex : 1 ,
@@ -49,6 +52,7 @@ type Props = {|
49
52
| 'gdevelop_gold'
50
53
| 'gdevelop_startup'
51
54
| 'gdevelop_education' ,
55
+ canHide ?: boolean ,
52
56
| } ;
53
57
54
58
const GetSubscriptionCard = ( {
@@ -61,7 +65,9 @@ const GetSubscriptionCard = ({
61
65
forceColumnLayout,
62
66
filter,
63
67
recommendedPlanIdIfNoSubscription,
68
+ canHide,
64
69
} : Props ) => {
70
+ const [ isHidden , setIsHidden ] = React . useState ( false ) ;
65
71
const { subscription } = React . useContext ( AuthenticatedUserContext ) ;
66
72
const actualPlanIdToRecommend = hasValidSubscriptionPlan ( subscription )
67
73
? // If the user already has a subscription, show the original subscription dialog.
@@ -72,6 +78,9 @@ const GetSubscriptionCard = ({
72
78
) ;
73
79
const { isMobile } = useResponsiveWindowSize ( ) ;
74
80
const columnLayout = forceColumnLayout || isMobile ;
81
+
82
+ if ( isHidden ) return null ;
83
+
75
84
return (
76
85
< div className = { classes . premiumContainer } >
77
86
< Paper style = { styles . paper } background = "medium" >
@@ -117,6 +126,19 @@ const GetSubscriptionCard = ({
117
126
</ ResponsiveLineStackLayout >
118
127
</ Column >
119
128
</ Line >
129
+ { canHide && (
130
+ < div style = { styles . topRightHideButton } >
131
+ < IconButton
132
+ aria-label = "hide"
133
+ onClick = { ( ) => {
134
+ setIsHidden ( true ) ;
135
+ } }
136
+ size = "small"
137
+ >
138
+ < Cross fontSize = "small" />
139
+ </ IconButton >
140
+ </ div >
141
+ ) }
120
142
</ Paper >
121
143
</ div >
122
144
) ;
0 commit comments