Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frame] Add ContextualSaveBar props to context #11826

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rude-boxes-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Added `contextualSaveBarVisible` and `contextualSaveBarProps` to `Frame` context
24 changes: 17 additions & 7 deletions polaris-react/src/components/Frame/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,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 @@ -282,6 +290,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
Loading