Skip to content

Conversation

@mateus
Copy link
Member

@mateus mateus commented May 31, 2023

WHY are these changes introduced?

Part of https://github.com/Shopify/polaris-summer-editions/issues/10

WHAT is this pull request doing?

Update Navigation styles for v11

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {
  HomeMinor,
  MarketingMinor,
  OrdersMinor,
  ProductsMinor,
  ViewMinor,
} from '@shopify/polaris-icons';

import {Frame, Navigation} from '../src';

export function Playground() {
  const [selected, setSelected] = React.useState('home');

  return (
    <Frame>
      <Navigation location="/">
        <Navigation.Section
          items={[
            {
              url: '#',
              excludePaths: ['#'],
              label: 'Home',
              icon: HomeMinor,
              onClick: () => setSelected('home'),
              matches: selected === 'home',
              secondaryAction: {
                url: '#',
                accessibilityLabel: 'View your online store',
                icon: ViewMinor,
                tooltip: {
                  content: 'View your online store',
                },
              },
            },
            {
              url: '#',
              excludePaths: ['#'],
              label: 'Orders',
              icon: OrdersMinor,
              badge: '15',
              onClick: () => setSelected('orders'),
              matches: selected === 'orders',
              subNavigationItems: [
                {
                  url: '#',
                  excludePaths: ['#'],
                  disabled: false,
                  label: 'Drafts',
                  onClick: () => setSelected('drafts'),
                  matches: selected === 'drafts',
                },
                {
                  url: '#',
                  excludePaths: ['#'],
                  disabled: false,
                  label: 'Shipping labels',
                  onClick: () => setSelected('shippinglabels'),
                  matches: selected === 'shippinglabels',
                },
              ],
            },
            {
              url: '#',
              excludePaths: ['#'],
              label: 'Marketing',
              icon: MarketingMinor,
              badge: '15',
              onClick: () => setSelected('marketing'),
              matches: selected === 'marketing',
              secondaryAction: {
                url: '#',
                accessibilityLabel: 'View your online store',
                icon: ViewMinor,
                tooltip: {
                  content: 'View your online store',
                },
              },
              subNavigationItems: [
                {
                  url: '#',
                  excludePaths: ['#'],
                  disabled: false,
                  label: 'Reports',
                  onClick: () => setSelected('reports'),
                  matches: selected === 'reports',
                },
                {
                  url: '#',
                  excludePaths: ['#'],
                  disabled: false,
                  label: 'Live view',
                  onClick: () => setSelected('liveView'),
                  matches: selected === 'liveView',
                },
              ],
            },
            {
              url: '#',
              label: 'Products',
              icon: ProductsMinor,
              onClick: () => setSelected('products'),
              matches: selected === 'products',
              subNavigationItems: [
                {
                  url: '#',
                  disabled: false,
                  label: 'Inventory',
                  onClick: () => setSelected('inventory'),
                  matches: selected === 'inventory',
                },
                {
                  url: '#',
                  disabled: false,
                  label: 'Transfers',
                  onClick: () => setSelected('transfers'),
                  matches: selected === 'transfers',
                },
                {
                  url: '#',
                  excludePaths: ['#'],
                  disabled: false,
                  label: 'Collections',
                  onClick: () => setSelected('collections'),
                  matches: selected === 'collections',
                },
                {
                  url: '#',
                  disabled: false,
                  label: 'Gift cards',
                  onClick: () => setSelected('gift_cards'),
                  matches: selected === 'gift_cards',
                },
                {
                  url: '#',
                  disabled: false,
                  label: 'Price lists',
                  onClick: () => setSelected('price_lists'),
                  matches: selected === 'price_lists',
                },
              ],
            },
          ]}
        />
      </Navigation>
    </Frame>
  );
}

🎩 checklist

@mateus mateus changed the title Navigation v11 style updates [Navigation] Update styles for v11 May 31, 2023
@mateus mateus force-pushed the navigation-v11 branch 2 times, most recently from 60428b0 to 610cfdd Compare May 31, 2023 20:10
@mateus mateus marked this pull request as ready for review May 31, 2023 20:11
@mateus mateus force-pushed the navigation-v11 branch 3 times, most recently from 2a54627 to 92ae058 Compare June 1, 2023 01:55
const stickyManager = useMemo(() => new StickyManager(), []);

const featuresConfig = useMemo(
() => ({...features, polarisSummerEditions2023: false}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polarisSummerEditions2023 was missing from the FeaturesContext and it was causing some tests to fail.

@sophschneider sophschneider force-pushed the v11.x.x branch 2 times, most recently from 430cd82 to 5d5de92 Compare June 1, 2023 15:14
Copy link
Contributor

@sophschneider sophschneider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! Did a tophat on storybook as well (looks great) but didn't cross reference with the Figma

@kyledurand
Copy link
Member

Can you update the focus states?

image

We've made the change to outline with outline offset. Here's an example of a focus ring override

Copy link
Member

@kyledurand kyledurand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks pretty good just some minor things 👍


#{$se23} & {
&::before {
display: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be content: none so the pseudo element doesn't render. Probably doesn't really matter but less dom elements

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change it. Both should achieve the same result 👍🏻

@mateus mateus merged commit 8ed44e3 into v11.x.x Jun 1, 2023
@mateus mateus deleted the navigation-v11 branch June 1, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants