Skip to content

Commit b6c7690

Browse files
chore(SelectPanel): put fullscreen functionality behind FF (#5832)
Co-authored-by: TylerJDev <[email protected]> Co-authored-by: francinelucca <[email protected]>
1 parent fe58f67 commit b6c7690

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

.changeset/fuzzy-beans-push.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
chore(SelectPanel): put fullscreen functionality behind FF

e2e/components/SelectPanel.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,15 @@ test.describe('SelectPanel', () => {
109109
)
110110
})
111111

112-
test(`Default @vrt responsive width .modern-action-list--true`, async ({page}) => {
112+
test(`Default @vrt responsive width .modern-action-list--true .fullscreen-on-narrow--true`, async ({page}) => {
113113
await visit(page, {
114114
id: 'components-selectpanel--default',
115-
globals: {featureFlags: {primer_react_select_panel_with_modern_action_list: true}},
115+
globals: {
116+
featureFlags: {
117+
primer_react_select_panel_with_modern_action_list: true,
118+
primer_react_select_panel_fullscreen_on_narrow: true,
119+
},
120+
},
116121
})
117122

118123
await page.setViewportSize({width: 767, height: 767})
@@ -125,7 +130,7 @@ test.describe('SelectPanel', () => {
125130
}
126131

127132
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
128-
`SelectPanel-Default-responsive-width-light-modern-action-list--true.png`,
133+
`SelectPanel-Default-responsive-width-light-modern-action-list--true-full-screen-on-narrow--true.png`,
129134
)
130135
})
131136
})

packages/react/src/FeatureFlags/DefaultFeatureFlags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export const DefaultFeatureFlags = FeatureFlagScope.create({
77
primer_react_select_panel_with_modern_action_list: false,
88
primer_react_overlay_overflow: false,
99
primer_react_segmented_control_tooltip: false,
10+
primer_react_select_panel_fullscreen_on_narrow: false,
1011
})

packages/react/src/SelectPanel/SelectPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ export function SelectPanel({
440440
}
441441
}
442442
const usingModernActionList = useFeatureFlag('primer_react_select_panel_with_modern_action_list')
443+
const usingFullScreenOnNarrow = useFeatureFlag('primer_react_select_panel_fullscreen_on_narrow')
443444

444445
const iconForNoticeVariant = {
445446
info: <InfoIcon size={16} />,
@@ -466,7 +467,7 @@ export function SelectPanel({
466467
height={height}
467468
width={width}
468469
anchorId={id}
469-
variant={{regular: 'anchored', narrow: 'fullscreen'}}
470+
variant={usingFullScreenOnNarrow ? {regular: 'anchored', narrow: 'fullscreen'} : undefined}
470471
pinPosition={!height}
471472
>
472473
<LiveRegionOutlet />
@@ -519,7 +520,7 @@ export function SelectPanel({
519520
</Box>
520521
) : null}
521522
</div>
522-
{onCancel && (
523+
{onCancel && usingFullScreenOnNarrow && (
523524
<IconButton
524525
type="button"
525526
variant="invisible"
@@ -579,7 +580,7 @@ export function SelectPanel({
579580
>
580581
{footer}
581582
</Box>
582-
) : isMultiSelectVariant(selected) ? (
583+
) : isMultiSelectVariant(selected) && usingFullScreenOnNarrow ? (
583584
/* Save and Cancel buttons are only useful for multiple selection, single selection instantly closes the panel */
584585
<div className={clsx(classes.Footer, classes.ResponsiveFooter)}>
585586
{/* we add a save and cancel button on narrow screens when SelectPanel is full-screen */}

0 commit comments

Comments
 (0)