Skip to content

Commit

Permalink
Panel: header and footer now reflow properly when zoomed in (#19547)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
TristanWatanabe authored Aug 31, 2021
1 parent abed5eb commit cb45155
Show file tree
Hide file tree
Showing 4 changed files with 373 additions and 343 deletions.
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 6 additions & 6 deletions packages/react/src/components/Panel/Panel.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ export class PanelBase extends React.Component<IPanelProps, IPanelState> impleme
style={customWidthStyles}
elementToFocusOnDismiss={elementToFocusOnDismiss}
>
<div className={_classNames.commands} data-is-visible={true}>
{onRenderNavigation(this.props, this._onRenderNavigation)}
</div>
<div className={_classNames.contentInner}>
{(this._hasCustomNavigation || !hasCloseButton) &&
onRenderHeader(this.props, this._onRenderHeader, this._headerTextId)}
<div ref={this._allowScrollOnPanel} className={_classNames.scrollableContent} data-is-scrollable={true}>
<div className={_classNames.commands} data-is-visible={true}>
{onRenderNavigation(this.props, this._onRenderNavigation)}
</div>
{(this._hasCustomNavigation || !hasCloseButton) &&
onRenderHeader(this.props, this._onRenderHeader, this._headerTextId)}
{onRenderBody(this.props, this._onRenderBody)}
{onRenderFooter(this.props, this._onRenderFooter)}
</div>
{onRenderFooter(this.props, this._onRenderFooter)}
</div>
</FocusTrapZone>
</div>
Expand Down
15 changes: 14 additions & 1 deletion packages/react/src/components/Panel/Panel.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit cb45155

Please sign in to comment.