Skip to content

Commit

Permalink
[IndexFilters] Use context provider for IndexFilters mode state (#10490)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?

Linked to Shopify/web#96682

We want to perform actions in other components whenever we enter the
non-default mode of the IndexFilters. This currently is limited to
disabling the actions in the `Page` component, but could be extended in
the future.

### WHAT is this pull request doing?

Adding a new context manager, `IndexFiltersManager`, which allows both
the IndexFilters component to use the `mode`, but also allows other
components, within Polaris and also within consumers of Polaris, to
react to the changes of the `mode`.

<!-- ℹ️ Delete the following for small / trivial changes -->

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

- Spinstance:
https://admin.web.if-disable-buttons.marc-thomas.eu.spin.dev/store/shop1/orders?inContextTimeframe=none
- Storybook:
https://5d559397bae39100201eedc1-objwwxomnz.chromatic.com/?path=/story/all-components-indexfilters--wrapped-in-a-page

### 🎩 checklist

- [x] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [x] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [x] Updated the component's `README.md` with documentation changes
- [x] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
  • Loading branch information
mrcthms committed Sep 21, 2023
1 parent 05c1379 commit 863f15f
Show file tree
Hide file tree
Showing 23 changed files with 452 additions and 324 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-wombats-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Add new `IndexFiltersManager` for allowing disabling of Page Header actions when in Filtering or EditingColumns mode
3 changes: 2 additions & 1 deletion polaris-react/src/components/AppProvider/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ScrollLockManager,
ScrollLockManagerContext,
} from '../../utilities/scroll-lock-manager';
import {IndexFiltersManager} from '../../utilities/index-filters';
import {
StickyManager,
StickyManagerContext,
Expand Down Expand Up @@ -179,7 +180,7 @@ export class AppProvider extends Component<AppProviderProps, State> {
<PortalsManager>
<FocusManager>
<EphemeralPresenceManager>
{children}
<IndexFiltersManager>{children}</IndexFiltersManager>
</EphemeralPresenceManager>
</FocusManager>
</PortalsManager>
Expand Down
Loading

0 comments on commit 863f15f

Please sign in to comment.