Skip to content

Conversation

chloerice
Copy link
Member

@chloerice chloerice commented Nov 30, 2018

WHY are these changes introduced?

Updates the page component's header to align with the Shopify mobile app's layout, which fixes #706.

WHAT is this pull request doing?

On small screens, the page component's header now rolls up secondary actions and action groups into a plain ellipsis button, which replaces pagination if it exists.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

  • git checkout page-mobile-rollup && yarn dev
  • Copy paste the example code collapsed below into /playground/Playground.tsx and navigate to localhost:8080**
  • Play with the window size to ensure the actions rollup as expected
  • Comment out the breadcrumbs prop to ensure the rollup still aligns right
  • Ensure the primary action is aligned left when secondary actions are rolled up
**Click to view collapsed example code
import * as React from 'react';
import {Page, Layout, Card} from '@shopify/polaris';

interface State {}

export default class Playground extends React.Component<{}, State> {
  render() {
    const content = (
      <Page
        title="Jar With Lock-Lid"
        breadcrumbs={[{content: 'Products', url: '/products'}]}
        pagination={{
          hasPrevious: true,
          hasNext: true,
        }}
        primaryAction={{content: 'Save', disabled: true}}
        secondaryActions={[
          {content: 'Duplicate'},
          {content: 'View on your store'},
        ]}
        actionGroups={[
          {
            title: 'Promote',
            actions: [{content: 'Share on Facebook'}],
          },
        ]}
      >
        <Layout>
          <Layout.Section>
            <Card sectioned>
              <p>Page content</p>
            </Card>
          </Layout.Section>
        </Layout>
      </Page>
    );

    return content;
  }
}

🎩 checklist

@BPScott BPScott temporarily deployed to polaris-react-pr-707 November 30, 2018 21:31 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 November 30, 2018 21:34 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 November 30, 2018 21:49 Inactive
.PrimaryAction {
display: flex;
align-self: stretch;
// align-self: stretch;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// align-self: stretch;

Copy link
Contributor

@sarahill sarahill left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thanks for doing this!

@dpersing
Copy link

dpersing commented Dec 7, 2018

Hi all! It looks like this is ready to merge and just needs some Percy review and an UNRELEASED.md update. Can that happen soonish?

@tmlayton
Copy link
Contributor

tmlayton commented Dec 8, 2018

Before After Design
All the things ⚠️ Ellipsis has slight vertical misalignment with breadcrumb
⚠️ Ellipsis icon should be ink color
screen shot 2018-12-08 at 4 03 52 pm screen shot 2018-12-08 at 4 18 31 pm screen shot 2018-12-08 at 4 15 31 pm
No breadcrumb ⚠️ Ellipsis should be vertically aligned with title
screen shot 2018-12-08 at 4 04 51 pm screen shot 2018-12-08 at 4 07 00 pm screen shot 2018-12-08 at 4 16 54 pm
No breadcrumb or pagination ⚠️ Ellipsis does not render
screen shot 2018-12-08 at 4 05 23 pm screen shot 2018-12-08 at 4 07 14 pm screen shot 2018-12-08 at 4 16 54 pm

Copy link
Contributor

@tmlayton tmlayton left a comment

Choose a reason for hiding this comment

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

A few things that need to be fixed with alignment, styles, and rendering

@sarahill
Copy link
Contributor

☝️ I'm seeing the same things as @tmlayton when I look at the deployment. When I tested locally with the different variations I wasn't seeing these issues.

@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 12, 2018 00:01 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 12, 2018 00:09 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 12, 2018 18:46 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 12, 2018 21:03 Inactive
@chloerice
Copy link
Member Author

chloerice commented Dec 12, 2018

@tmlayton @sarahill I've fixed all issues 👍 Be sure to hard refresh and clear your cache when viewing the examples in the latest deployment 😺

screen shot 2018-12-12 at 4 28 34 pm

Regarding the difference in fill between the example in the issue and this PR: I don't think it would add value to write smelly Sass in order to override the fill of the plain icon button. All plain buttons have color('ink', 'lighter'), including the breadcrumb it sits across from. Changing that would also make the focus fill color the same as the unfocused fill color.

@chloerice chloerice dismissed tmlayton’s stale review December 12, 2018 21:54

(Made the requested changes)

@sarahill
Copy link
Contributor

sarahill commented Dec 13, 2018

The alignnment is looking good to me just seeing a couple things still.

The example with external link and action groups isn't rolling up.

screen shot 2018-12-13 at 10 24 45 am

screen shot 2018-12-13 at 10 26 40 am

Copy link
Contributor

@sarahill sarahill left a comment

Choose a reason for hiding this comment

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

This is close!

Left a comment on a couple things.

@chloerice
Copy link
Member Author

The example with external link and action groups isn't rolling up.

Hey @sarahill, the current UX for the rollup is that it only rolls up when the actions don't fit. Is part of the desired outcome of this feature request to change that so that actions (other than the primary) always rollup?

@sarahill
Copy link
Contributor

@chloerice Ah I see. That was my original thought but this makes more sense. Show them if we can and roll them up if they don't fit.

Thanks for clarifying 👍 and thank you again for doing this 🙌

Copy link
Contributor

@sarahill sarahill left a comment

Choose a reason for hiding this comment

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

Clarified the functionality of this with Chloe.

Looks good to me ✅

@chloerice
Copy link
Member Author

chloerice commented Dec 13, 2018

@sarahill Dug into it further and I think your original thought was right and updated for consistency's sake. Primary button labels can get pretty lengthy in German, don't want to end up in situations like this:

Rollup always Rollup when > 1 secondary action/group
screen shot 2018-12-13 at 11 31 20 am screen shot 2018-12-13 at 11 31 33 am

@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 13, 2018 19:40 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 13, 2018 19:41 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 13, 2018 19:42 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-707 December 13, 2018 19:44 Inactive
@sarahill
Copy link
Contributor

☝️ nice catch!

@sarahill
Copy link
Contributor

@chloerice this looks like it's ready to go.

@tmlayton any objections?

UNRELEASED.md Outdated
### Enhancements

- Moved icons to a separate npm package ([#686](https://github.com/Shopify/polaris-react/pull/686))
- Updated the `Page.Header` so that actions take up less room on small screens ([#707](https://github.com/Shopify/polaris-react/pull/707))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Updated the `Page.Header` so that actions take up less room on small screens ([#707](https://github.com/Shopify/polaris-react/pull/707))
- Updated the `Page` so that actions take up less room on small screens ([#707](https://github.com/Shopify/polaris-react/pull/707))

I would just say Page because for a consumer that is the only API they know

</DisplayText>
<div className={styles.TitleAndRollup}>
<div className={styles.Title}>
{/* Anonymous divs are here for layout purposes */}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a side note, no need to do anything here, but when I see a comment like this I wonder if we can instead write the code in a more meaningful way like creating a component called AnonymousDivForLayout that just renders a div.

Copy link
Contributor

@tmlayton tmlayton left a comment

Choose a reason for hiding this comment

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

Nitpick on the changelog entry, also needs a rebase. Otherwise this looks awesome, so much better! Nice work @chloerice, @HYPD, and @ivymukherjee92

@chloerice chloerice merged commit 90cf824 into master Dec 20, 2018
@danrosenthal danrosenthal temporarily deployed to production January 7, 2019 14:27 Inactive
@kaelig kaelig deleted the page-mobile-rollup branch February 21, 2019 00:50
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.

[Page header] Replace pagination on mobile web with actions overflow ellipsis

6 participants