Skip to content

Commit

Permalink
Add in contextual save bar in context
Browse files Browse the repository at this point in the history
  • Loading branch information
sophschneider committed Apr 3, 2024
1 parent ab8a8cc commit 9066086
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
25 changes: 18 additions & 7 deletions polaris-react/src/components/Frame/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
CSSAnimation,
} from './components';
import styles from './Frame.module.css';
import {UseFeatures} from '../../utilities/features';

export interface FrameProps {
/** Sets the logo for the TopBar, Navigation, and ContextualSaveBar components */
Expand Down Expand Up @@ -246,13 +247,21 @@ class FrameInner extends PureComponent<CombinedProps, State> {
);

const contextualSaveBarMarkup = (
<CSSAnimation
in={showContextualSaveBar}
className={styles.ContextualSaveBar}
type="fade"
>
<ContextualSaveBar {...this.contextualSaveBar} />
</CSSAnimation>
<UseFeatures>
{({dynamicTopBarAndReframe}) =>
dynamicTopBarAndReframe ? (
<></>
) : (
<CSSAnimation
in={showContextualSaveBar}
className={styles.ContextualSaveBar}
type="fade"
>
<ContextualSaveBar {...this.contextualSaveBar} />
</CSSAnimation>
)
}
</UseFeatures>
);

const navigationOverlayMarkup =
Expand All @@ -275,6 +284,8 @@ class FrameInner extends PureComponent<CombinedProps, State> {
stopLoading: this.stopLoading,
setContextualSaveBar: this.setContextualSaveBar,
removeContextualSaveBar: this.removeContextualSaveBar,
contextualSaveBarVisible: this.state.showContextualSaveBar,
contextualSaveBarProps: this.contextualSaveBar,
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ function createFrameContext({
toastMessages = [],
setContextualSaveBar = noop,
removeContextualSaveBar = noop,
contextualSaveBarVisible = false,
contextualSaveBarProps = {},
startLoading = noop,
stopLoading = noop,
}: Partial<FrameContextType> = {}): FrameContextType {
Expand All @@ -128,6 +130,8 @@ function createFrameContext({
toastMessages,
setContextualSaveBar,
removeContextualSaveBar,
contextualSaveBarVisible,
contextualSaveBarProps,
startLoading,
stopLoading,
};
Expand Down
2 changes: 2 additions & 0 deletions polaris-react/src/utilities/frame/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export interface FrameContextType {
toastMessages: ToastPropsWithID[];
setContextualSaveBar(props: ContextualSaveBarProps): void;
removeContextualSaveBar(): void;
contextualSaveBarVisible: boolean;
contextualSaveBarProps: ContextualSaveBarProps | null;
startLoading(): void;
stopLoading(): void;
}
Expand Down

0 comments on commit 9066086

Please sign in to comment.