Skip to content

Commit dcdd928

Browse files
fix(onboarding): Do not display selection styles in the new changes
1 parent 2eca86d commit dcdd928

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

static/app/components/platformPicker.tsx

+31-21
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ interface PlatformPickerProps {
5959
showFilterBar?: boolean;
6060
showOther?: boolean;
6161
source?: string;
62+
/**
63+
* When `false`, hides the close button and does not display a custom background color.
64+
*/
65+
visibleSelection?: boolean;
6266
}
6367

6468
type State = {
@@ -69,6 +73,7 @@ type State = {
6973
class PlatformPicker extends Component<PlatformPickerProps, State> {
7074
static defaultProps = {
7175
showOther: true,
76+
visibleSelection: true,
7277
};
7378

7479
state: State = {
@@ -192,6 +197,7 @@ class PlatformPicker extends Component<PlatformPickerProps, State> {
192197
{platformList.map(platform => {
193198
return (
194199
<PlatformCard
200+
visibleSelection={this.props.visibleSelection}
195201
data-test-id={`platform-${platform.id}`}
196202
key={platform.id}
197203
platform={platform}
@@ -295,36 +301,40 @@ const ClearButton = styled(Button)`
295301
color: ${p => p.theme.textColor};
296302
`;
297303

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"
315313
/>
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+
)`
319327
position: relative;
320328
display: flex;
321329
flex-direction: column;
322330
align-items: center;
323331
padding: 0 0 14px;
324332
border-radius: 4px;
325-
background: ${p => p.selected && p.theme.alert.info.backgroundLight};
326333
cursor: pointer;
327334
335+
${p =>
336+
p.selected && p.visibleSelection && `background: ${p.theme.alert.info.background};`}
337+
328338
&:hover {
329339
background: ${p => p.theme.alert.muted.backgroundLight};
330340
}

static/app/views/onboarding/onboarding.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,18 @@ function Onboarding(props: Props) {
251251
...onboardingContext.data,
252252
projects: currentProjects,
253253
});
254+
if (docsOnPlatformClickEnabled) {
255+
onboardingContext.setData({
256+
...onboardingContext.data,
257+
projects: currentProjects,
258+
selectedSDK: undefined,
259+
});
260+
} else {
261+
onboardingContext.setData({
262+
...onboardingContext.data,
263+
projects: currentProjects,
264+
});
265+
}
254266
handleXhrErrorResponse('Unable to delete project in onboarding', error);
255267
// we don't give the user any feedback regarding this error as this shall be silent
256268
}

static/app/views/onboarding/platformSelection.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function PlatformSelection(props: StepProps) {
5959
</p>
6060
<PlatformPicker
6161
noAutoFilter
62+
visibleSelection={!docsOnPlatformClickEnabled}
6263
source="targeted-onboarding"
6364
platform={onboardingContext.data.selectedSDK?.key}
6465
defaultCategory={onboardingContext.data.selectedSDK?.category}

0 commit comments

Comments
 (0)