Skip to content

Commit e7a69f4

Browse files
committed
fixed spacing for secondary actions and truncated text
1 parent a9f1300 commit e7a69f4

File tree

4 files changed

+64
-24
lines changed

4 files changed

+64
-24
lines changed

polaris-react/src/components/Navigation/Navigation.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ $disabled-fade: 0.6;
195195
display: flex;
196196
flex-wrap: nowrap;
197197
width: 100%;
198+
margin: 0 var(--p-space-1);
198199
}
199200

200201
.Text {
@@ -216,7 +217,6 @@ $disabled-fade: 0.6;
216217
display: flex;
217218
align-items: center;
218219
height: nav(mobile-height);
219-
margin-right: var(--p-space-1);
220220
padding: var(--p-space-1) var(--p-space-4);
221221
border-radius: var(--p-border-radius-1);
222222

polaris-react/src/components/Navigation/Navigation.stories.tsx

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,67 @@ export function WithASecondaryActionForAnItem() {
249249
);
250250
}
251251

252+
export function WithTruncationForVariousStates() {
253+
return (
254+
<Frame>
255+
<Navigation location="/">
256+
<Navigation.Section
257+
items={[
258+
{
259+
url: '/path/to/place',
260+
label: 'A very long label to ellipsize',
261+
truncateText: true,
262+
icon: OrdersMinor,
263+
selected: false,
264+
},
265+
{
266+
url: '/path/to/place',
267+
label: 'Lengthy label with secondary action',
268+
icon: OrdersMinor,
269+
selected: false,
270+
truncateText: true,
271+
secondaryAction: {
272+
url: '/admin/orders/add',
273+
accessibilityLabel: 'Add an order',
274+
icon: CirclePlusOutlineMinor,
275+
tooltip: {
276+
content: 'Add a lengthy order',
277+
},
278+
},
279+
},
280+
{
281+
url: '/path/to/place',
282+
label: 'Lengthy label with badge',
283+
truncateText: true,
284+
badge: 'Old',
285+
icon: HomeMinor,
286+
},
287+
{
288+
url: '/admin/products',
289+
label: 'Truncated secondary navigation items',
290+
icon: ProductsMinor,
291+
selected: true,
292+
truncateText: true,
293+
subNavigationItems: [
294+
{
295+
url: '/admin/products/collections',
296+
disabled: false,
297+
label: 'Something longer than collections',
298+
},
299+
{
300+
url: '/admin/products/inventory',
301+
disabled: false,
302+
label: 'Inventoy',
303+
},
304+
],
305+
},
306+
]}
307+
/>
308+
</Navigation>
309+
</Frame>
310+
);
311+
}
312+
252313
export function WithSectionRollup() {
253314
return (
254315
<Frame>
@@ -363,28 +424,6 @@ export function WithVariousStatesAndSecondaryElements() {
363424
badge: 'Old',
364425
icon: HomeMinor,
365426
},
366-
{
367-
url: '/path/to/place',
368-
label: 'A very long label to ellipsize',
369-
truncateText: true,
370-
icon: OrdersMinor,
371-
selected: false,
372-
},
373-
{
374-
url: '/path/to/place',
375-
label: 'Truncated lengthy text with secondary action',
376-
icon: OrdersMinor,
377-
selected: false,
378-
truncateText: true,
379-
secondaryAction: {
380-
url: '/admin/orders/add',
381-
accessibilityLabel: 'Add an order',
382-
icon: CirclePlusOutlineMinor,
383-
tooltip: {
384-
content: 'Add an order',
385-
},
386-
},
387-
},
388427
{
389428
url: '/path/to/place',
390429
label: 'Active with secondary action',

polaris-react/src/components/Navigation/_variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $nav-animation-variables: (
2828
align-items: flex-start;
2929
max-width: 100%;
3030
padding: 0 var(--p-space-1) 0 var(--p-space-3);
31-
margin: 0 var(--p-space-2);
31+
margin-left: var(--p-space-1);
3232
border-radius: var(--p-border-radius-1);
3333
color: var(--p-text);
3434
text-decoration: none;

polaris-react/src/components/Navigation/components/Item/Item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ export function Item({
302302
label={label}
303303
matches={item === longestMatch}
304304
onClick={onClick}
305+
truncateText={truncateText}
305306
/>
306307
);
307308
})}

0 commit comments

Comments
 (0)