Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tender-kings-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Updated badge spacing to right align with secondary action icons
5 changes: 5 additions & 0 deletions polaris-react/src/components/Navigation/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ $disabled-fade: 0.6;
margin-left: var(--p-space-2);
display: inline-flex;
margin-top: var(--p-space-2);
margin-right: var(--p-space-2);

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

.ListItem-hasAction .Badge {
margin-right: 0;
}

.Icon {
@include nav-item-icon-attributes;
}
Expand Down
92 changes: 92 additions & 0 deletions polaris-react/src/components/Navigation/Navigation.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -606,3 +606,95 @@ export function UsingMajorIcons() {
</Frame>
);
}

export function WithBadgeAndSecondaryAction() {
return (
<Frame>
<Navigation location="/">
<Navigation.Section
items={[
{
url: '/path/to/place',
label: 'Home',
icon: HomeMinor,
secondaryAction: {
url: '/path/to/place/view',
accessibilityLabel: 'View your online store',
icon: ViewMinor,
tooltip: {
content: 'View your online store',
},
},
},
{
url: '/path/to/place',
label: 'Orders',
icon: OrdersMinor,
badge: '15',
subNavigationItems: [
{
url: '/admin/orders/collections',
disabled: false,
selected: false,
label: 'Collections',
},
{
url: '/admin/orders/inventory',
disabled: false,
label: 'Inventory',
},
],
},
{
url: '/path/to/place',
label: 'Marketing',
icon: MarketingMinor,
badge: '15',
secondaryAction: {
url: '/path/to/place/view',
accessibilityLabel: 'View your online store',
icon: ViewMinor,
tooltip: {
content: 'View your online store',
},
},
subNavigationItems: [
{
url: '/admin/analytics/collections',
disabled: false,
selected: false,
label: 'Reports',
},
{
url: '/admin/analytics/inventory',
disabled: false,
label: 'Live view',
},
],
},
{
url: '/admin/products',
label: 'Products',
icon: ProductsMinor,
selected: true,
subNavigationItems: [
{
url: '/?path=/story/all-components-navigation--navigation-with-multiple-secondary-navigations',
disabled: false,
selected: false,
label: 'Collections',
},
{
url: '/admin/products/inventory',
disabled: false,
selected: true,
label: 'Inventory',
},
],
},
]}
/>
</Navigation>
</Frame>
);
}