You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Navigation] Add a new prop to truncate nav item text (Shopify#7619)
<!--
☝️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?
Overwrites have been used in admin to get navigation item text to
truncate with ellipsis since the app pinning project. This is an effort
to port the changes to Polaris to reduce the overwriting and tech debt
in core.
Fixeshttps://github.com/Shopify/core-workflows/issues/561 <!-- link to
issue if one exists -->
<!--
Context about the problem that’s being addressed.
-->
### WHAT is this pull request doing?
I've added a prop to allow text truncation in navigation items. It
applies a class that stops the line wrapping of item text and instead
does an ellipsis truncation through CSS.
<!--
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>
-->
<img width="275" alt="Screen Shot 2022-11-04 at 12 20 29 PM"
src="https://user-images.githubusercontent.com/33904740/200025372-15995417-9fda-468f-9ab0-75d1a24b8c89.png">
There is a new story for the truncation enabled items. Here you can see
anything going beyond the width of the text container will be truncated
with ellipsis. Notice that "Inventory" is fine as it not long enough to
trigger it. Secondary navigation items are also treated the same as
their parent.
<!-- ℹ️ 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)
<!--
Give as much information as needed to experiment with the component
in the playground.
-->
<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>
```jsx
import React from 'react';
import {Page} from '../src';
export function Playground() {
return (
<Page title="Playground">
{/* Add the code you want to test in here */}
</Page>
);
}
```
</details>
### 🎩 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)
- [ ] 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
0 commit comments