From cb4515542336a543ccb15f1ea9a9cb0ec4d33330 Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 30 Aug 2021 21:48:34 -0400 Subject: [PATCH] Panel: header and footer now reflow properly when zoomed in (#19547) * move commands, header and footer inside scrollable content * add height based media query which fixes header and footer on screen when minimum height is met * update react snapshots * Change files --- ...-6112fdea-f8c4-4731-90f1-466f69c0e659.json | 7 + .../react/src/components/Panel/Panel.base.tsx | 12 +- .../src/components/Panel/Panel.styles.ts | 15 +- .../Panel/__snapshots__/Panel.test.tsx.snap | 682 +++++++++--------- 4 files changed, 373 insertions(+), 343 deletions(-) create mode 100644 change/@fluentui-react-6112fdea-f8c4-4731-90f1-466f69c0e659.json diff --git a/change/@fluentui-react-6112fdea-f8c4-4731-90f1-466f69c0e659.json b/change/@fluentui-react-6112fdea-f8c4-4731-90f1-466f69c0e659.json new file mode 100644 index 00000000000000..b88d44a6c3b48e --- /dev/null +++ b/change/@fluentui-react-6112fdea-f8c4-4731-90f1-466f69c0e659.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Panel: header and footer now reflow properly when zoomed in.", + "packageName": "@fluentui/react", + "email": "tristan.watanabe@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react/src/components/Panel/Panel.base.tsx b/packages/react/src/components/Panel/Panel.base.tsx index 81fa15ffbb36f8..cdd045444f8495 100644 --- a/packages/react/src/components/Panel/Panel.base.tsx +++ b/packages/react/src/components/Panel/Panel.base.tsx @@ -241,16 +241,16 @@ export class PanelBase extends React.Component impleme style={customWidthStyles} elementToFocusOnDismiss={elementToFocusOnDismiss} > -
- {onRenderNavigation(this.props, this._onRenderNavigation)} -
- {(this._hasCustomNavigation || !hasCloseButton) && - onRenderHeader(this.props, this._onRenderHeader, this._headerTextId)}
+
+ {onRenderNavigation(this.props, this._onRenderNavigation)} +
+ {(this._hasCustomNavigation || !hasCloseButton) && + onRenderHeader(this.props, this._onRenderHeader, this._headerTextId)} {onRenderBody(this.props, this._onRenderBody)} + {onRenderFooter(this.props, this._onRenderFooter)}
- {onRenderFooter(this.props, this._onRenderFooter)}
diff --git a/packages/react/src/components/Panel/Panel.styles.ts b/packages/react/src/components/Panel/Panel.styles.ts index 9a56a78235f157..d1821c78464a77 100644 --- a/packages/react/src/components/Panel/Panel.styles.ts +++ b/packages/react/src/components/Panel/Panel.styles.ts @@ -258,7 +258,14 @@ export const getStyles = (props: IPanelStyleProps): IPanelStyles => { commands: [ classNames.commands, { - marginTop: 18, + paddingTop: 18, + selectors: { + [`@media (min-height: ${ScreenWidthMinMedium}px)`]: { + backgroundColor: semanticColors.bodyBackground, + position: 'sticky', + top: 0, + }, + }, }, hasCustomNavigation && { marginTop: 'inherit', @@ -334,6 +341,12 @@ export const getStyles = (props: IPanelStyleProps): IPanelStyles => { flexShrink: 0, borderTop: '1px solid transparent', transition: `opacity ${AnimationVariables.durationValue3} ${AnimationVariables.easeFunction2}`, + selectors: { + [`@media (min-height: ${ScreenWidthMinMedium}px)`]: { + position: 'sticky', + bottom: 0, + }, + }, }, isFooterSticky && { background: semanticColors.bodyBackground, diff --git a/packages/react/src/components/Panel/__snapshots__/Panel.test.tsx.snap b/packages/react/src/components/Panel/__snapshots__/Panel.test.tsx.snap index 837dd712cfc909..de3c9d7e1b7a66 100644 --- a/packages/react/src/components/Panel/__snapshots__/Panel.test.tsx.snap +++ b/packages/react/src/components/Panel/__snapshots__/Panel.test.tsx.snap @@ -165,204 +165,209 @@ exports[`Panel allows the consumer to pass through popup props 1`] = ` />
-
- Test Panel -
-
-
+ -
- -
-
+ + +  + + + +
+
-
- Test Panel -
-
-
+ -
-
-
-
+ + +  + + + +
+