Skip to content

Commit 764ea83

Browse files
committed
fixing badges in polaris
1 parent 167791e commit 764ea83

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

.changeset/tender-kings-approve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Updated badge spacing to right align with secondary action icons

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,17 @@ $disabled-fade: 0.6;
159159
margin-left: var(--p-space-2);
160160
display: inline-flex;
161161
margin-top: var(--p-space-2);
162+
margin-right: var(--p-space-2);
162163

163164
@media #{$p-breakpoints-md-up} {
164165
margin-top: var(--p-space-1);
165166
}
166167
}
167168

169+
.ListItem-hasAction .Badge {
170+
margin-right: 0;
171+
}
172+
168173
.Icon {
169174
@include nav-item-icon-attributes;
170175
}

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,95 @@ export function UsingMajorIcons() {
606606
</Frame>
607607
);
608608
}
609+
610+
export function WithBadgeAndSecondaryAction() {
611+
return (
612+
<Frame>
613+
<Navigation location="/">
614+
<Navigation.Section
615+
items={[
616+
{
617+
url: '/path/to/place',
618+
label: 'Home',
619+
icon: HomeMinor,
620+
secondaryAction: {
621+
url: '/path/to/place/view',
622+
accessibilityLabel: 'View your online store',
623+
icon: ViewMinor,
624+
tooltip: {
625+
content: 'View your online store',
626+
},
627+
},
628+
},
629+
{
630+
url: '/path/to/place',
631+
label: 'Orders',
632+
icon: OrdersMinor,
633+
badge: '15',
634+
subNavigationItems: [
635+
{
636+
url: '/admin/orders/collections',
637+
disabled: false,
638+
selected: false,
639+
label: 'Collections',
640+
},
641+
{
642+
url: '/admin/orders/inventory',
643+
disabled: false,
644+
label: 'Inventory',
645+
},
646+
],
647+
},
648+
{
649+
url: '/path/to/place',
650+
label: 'Marketing',
651+
icon: MarketingMinor,
652+
badge: '15',
653+
secondaryAction: {
654+
url: '/path/to/place/view',
655+
accessibilityLabel: 'View your online store',
656+
icon: ViewMinor,
657+
tooltip: {
658+
content: 'View your online store',
659+
},
660+
},
661+
subNavigationItems: [
662+
{
663+
url: '/admin/analytics/collections',
664+
disabled: false,
665+
selected: false,
666+
label: 'Reports',
667+
},
668+
{
669+
url: '/admin/analytics/inventory',
670+
disabled: false,
671+
label: 'Live view',
672+
},
673+
],
674+
},
675+
{
676+
url: '/admin/products',
677+
label: 'Products',
678+
icon: ProductsMinor,
679+
selected: true,
680+
subNavigationItems: [
681+
{
682+
url: '/?path=/story/all-components-navigation--navigation-with-multiple-secondary-navigations',
683+
disabled: false,
684+
selected: false,
685+
label: 'Collections',
686+
},
687+
{
688+
url: '/admin/products/inventory',
689+
disabled: false,
690+
selected: true,
691+
label: 'Inventory',
692+
},
693+
],
694+
},
695+
]}
696+
/>
697+
</Navigation>
698+
</Frame>
699+
);
700+
}

0 commit comments

Comments
 (0)