Skip to content

Commit

Permalink
Update Space-0 Token To Have a Unit (#9904)
Browse files Browse the repository at this point in the history
<!--
  ☝️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
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Using a unitless value (aka `0`) inside of a `calc` causes `calc` to
error, thus breaking the CSS rule you are trying to use. Here, I am
adding a unit to the value to fix this problem. Per [this design tokens
format
module](https://design-tokens.github.io/community-group/format/#dimension),
values should include units, including 0.

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

<!--
  Summary of the changes committed.

Before / after screenshots are appreciated for UI changes. Make sure to
include alt text that describes the screenshot.

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>
-->

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

This is allowing for the `space-0` token to be used inside of a `calc`.

### 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)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

I built the tokens package and saw the correct value was outputted in
the build file.

```
--p-space-0:0rem;
```

Documentation is updated

<img width="1374" alt="image"
src="https://github.com/Shopify/polaris/assets/3689812/e251151d-cf8d-416b-92d8-e7501e0a7783">


### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Aaron Casanova <[email protected]>
  • Loading branch information
benwolfram and aaronccasanova authored Aug 8, 2023
1 parent 93b9020 commit 36e4ee8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clever-sheep-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-tokens': patch
---

Added a unit to the `space-0` token
2 changes: 1 addition & 1 deletion polaris-tokens/src/token-groups/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const space: {
[TokenName in SpaceTokenName]: MetadataProperties;
} = {
'space-0': {
value: '0',
value: '0px',
},
'space-025': {
value: '1px',
Expand Down

0 comments on commit 36e4ee8

Please sign in to comment.