@@ -59,6 +59,10 @@ interface PlatformPickerProps {
59
59
showFilterBar ?: boolean ;
60
60
showOther ?: boolean ;
61
61
source ?: string ;
62
+ /**
63
+ * When `false`, hides the close button and does not display a custom background color.
64
+ */
65
+ visibleSelection ?: boolean ;
62
66
}
63
67
64
68
type State = {
@@ -69,6 +73,7 @@ type State = {
69
73
class PlatformPicker extends Component < PlatformPickerProps , State > {
70
74
static defaultProps = {
71
75
showOther : true ,
76
+ visibleSelection : true ,
72
77
} ;
73
78
74
79
state : State = {
@@ -192,6 +197,7 @@ class PlatformPicker extends Component<PlatformPickerProps, State> {
192
197
{ platformList . map ( platform => {
193
198
return (
194
199
< PlatformCard
200
+ visibleSelection = { this . props . visibleSelection }
195
201
data-test-id = { `platform-${ platform . id } ` }
196
202
key = { platform . id }
197
203
platform = { platform }
@@ -295,36 +301,40 @@ const ClearButton = styled(Button)`
295
301
color: ${ p => p . theme . textColor } ;
296
302
` ;
297
303
298
- const PlatformCard = styled ( ( { platform, selected, onClear, ...props } : any ) => (
299
- < div { ...props } >
300
- < StyledPlatformIcon
301
- platform = { platform . id }
302
- size = { 56 }
303
- radius = { 5 }
304
- withLanguageIcon
305
- format = "lg"
306
- />
307
- < h3 > { platform . name } </ h3 >
308
- { selected && (
309
- < ClearButton
310
- icon = { < IconClose isCircled /> }
311
- borderless
312
- size = "xs"
313
- onClick = { onClear }
314
- aria-label = { t ( 'Clear' ) }
304
+ const PlatformCard = styled (
305
+ ( { platform, selected, visibleSelection, onClear, ...props } : any ) => (
306
+ < div { ...props } >
307
+ < StyledPlatformIcon
308
+ platform = { platform . id }
309
+ size = { 56 }
310
+ radius = { 5 }
311
+ withLanguageIcon
312
+ format = "lg"
315
313
/>
316
- ) }
317
- </ div >
318
- ) ) `
314
+ < h3 > { platform . name } </ h3 >
315
+ { selected && visibleSelection && (
316
+ < ClearButton
317
+ icon = { < IconClose isCircled /> }
318
+ borderless
319
+ size = "xs"
320
+ onClick = { onClear }
321
+ aria-label = { t ( 'Clear' ) }
322
+ />
323
+ ) }
324
+ </ div >
325
+ )
326
+ ) `
319
327
position: relative;
320
328
display: flex;
321
329
flex-direction: column;
322
330
align-items: center;
323
331
padding: 0 0 14px;
324
332
border-radius: 4px;
325
- background: ${ p => p . selected && p . theme . alert . info . backgroundLight } ;
326
333
cursor: pointer;
327
334
335
+ ${ p =>
336
+ p . selected && p . visibleSelection && `background: ${ p . theme . alert . info . background } ;` }
337
+
328
338
&:hover {
329
339
background: ${ p => p . theme . alert . muted . backgroundLight } ;
330
340
}
0 commit comments