Commit 6ca51eb
authored
Polaris tokens - add interaction based media queries for touch/non-to… (#12331)
<!--
☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
- Start with a verb, for example: Add, Delete, Improve, Fix…
- Give as much context as necessary and as little as possible
- Open it as a draft if it’s a work in progress
-->
### WHY are these changes introduced?
This PR adds interaction based media queries to `polaris-tokens` which
will allow us to target touch based devices.
Inspired by
[open-props](https://github.com/argyleink/open-props/blob/main/src/props.media.css#L25C31-L25C58)
and also symetrical with our [hooks
api](https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/use-media-query.ts#L9).
<!--
Context about the problem that’s being addressed.
-->
### WHAT is this pull request doing?
We have added code to our css/scss code generation to append interaction
media queries
Added to media-queries.css
```
@Custom-Media --p-interaction-touch (hover: none) and (pointer: coarse);
@Custom-Media --p-interaction-stylus (hover: none) and (pointer: fine);
@Custom-Media --p-interaction-pointer (hover) and (pointer: coarse);
@Custom-Media --p-interaction-mouse (hover) and (pointer: fine);
```
Added to media-queries.scss
```
$p-interaction-touch: '(hover: none) and (pointer: coarse)';
$p-interaction-stylus: '(hover: none) and (pointer: fine)';
$p-interaction-pointer: '(hover) and (pointer: coarse)';
$p-interaction-mouse: '(hover) and (pointer: fine)';
```
<!--
Summary of the changes committed.
Before / after screenshots are appreciated for UI changes. Make sure to
include alt text that describes the screenshot.
Include a video if your changes include interactive content.
If you include an animated gif showing your change, wrapping it in a
details tag is recommended. Gifs usually autoplay, which can cause
accessibility issues for people reviewing your PR:
<details>
<summary>Summary of your gif(s)</summary>
<img src="..." alt="Description of what the gif shows">
</details>
-->
### How to 🎩
🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#install-dependencies-and-build-workspaces)
🗒 [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)
### 🎩 checklist
- [x] Tested a
[snapshot](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#-snapshot-releases)
- [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 guide1 parent ab50010 commit 6ca51eb
File tree
2 files changed
+40
-4
lines changed- .changeset
- polaris-tokens/scripts
2 files changed
+40
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
45 | | - | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
50 | 64 | | |
51 | 65 | | |
52 | 66 | | |
| |||
66 | 80 | | |
67 | 81 | | |
68 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments