Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update page component to match v1.10.2 #78

Merged
merged 13 commits into from Feb 9, 2018

Conversation

andrewpye
Copy link
Member

@andrewpye andrewpye commented Jan 31, 2018

Brings polaris-page in line with the latest Polaris release and tidies up the component's structure. New features include responsiveness for page actions, an optional separator between page header and content, and a singleColumn width option.

Separator:
image

Example of actions responsiveness in the dummy app (N.B. the caret for the secondary actions list doesn't render because the icon's not included in the dummy app and didn't seem worth adding just for this):

polaris-page-update

P.S. template source for the above GIF is just a simple page with a primary action and a couple of secondary ones:

{{#polaris-page
  title="This is the application route"
  primaryAction=(hash text="Primary" action=(action (mut primaryClicked) true))
  secondaryActions=(array
    (hash text="Secondary 1" action=(action (mut secondary1Clicked) true))
    (hash text="Secondary 2" action=(action (mut secondary2Clicked) true))
  )
}}
  <div>Primary clicked: {{primaryClicked}}</div>
  <div>Secondary 1 clicked: {{secondary1Clicked}}</div>
  <div>Secondary 2 clicked: {{secondary2Clicked}}</div>
{{/polaris-page}}

@andrewpye andrewpye self-assigned this Jan 31, 2018
@andrewpye andrewpye mentioned this pull request Jan 31, 2018
28 tasks
Copy link
Member

@vladucu vladucu left a comment

Choose a reason for hiding this comment

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

couple of comments / questions

* @type {boolean}
* @default false
*/
separator: false,
Copy link
Member

Choose a reason for hiding this comment

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

can we list here actionGroups property and add a TODO?


hasActions: or('primaryAction', 'secondaryActions'),

hasRollup: computed('secondaryActions.[]', function() {
Copy link
Member

Choose a reason for hiding this comment

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

use gt computed

import layout from '../templates/components/polaris-breadcrumbs';

export default Component.extend({
classNames: [ 'Polaris-Page__Navigation' ],
Copy link
Member

Choose a reason for hiding this comment

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

the Polaris breadcrumbs uses a nav for the tag and doesn't has this class? Should we update like in polaris and move the class in a div in the page-header component?
or is there something I'm missing?

--}}
{{#with (if primaryAction
(component "polaris-button"
primary=(not primaryAction.destructive)
Copy link
Member

Choose a reason for hiding this comment

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

don't see this destructive condition in Polaris

Copy link
Member Author

Choose a reason for hiding this comment

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

Great catch, thanks!

{{/if}}

<div class="Polaris-Page__IndividualActions">
{{#each secondaryActions as |secondaryAction|}}
Copy link
Member

Choose a reason for hiding this comment

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

should this each be wrapper in a if secondaryActions?

{{polaris-breadcrumbs breadcrumbs=breadcrumbs}}
{{/if}}

{{#wrapper-element
Copy link
Member

Choose a reason for hiding this comment

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

all these wrapper elements are super neat....but I wonder if it wouldn't be much more readable if we'd just use if else statements even if that means a bit of duplication

Copy link
Member Author

Choose a reason for hiding this comment

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

It'd mean a lot of duplication, basically the entire template. That'd make maintaining any future updates (which are likely to be fairly minor I'd guess since the React implementation seems to have matured a lot) trickier, both in terms of knowing that each update has to be added twice, and from the extra amount of code the maintainer will have to scroll through. I do see where you're coming from though, so I'll add comments to each of the potentially confusing wrapper-element usages so that their intent can be seen instantly 👍

Copy link
Member

Choose a reason for hiding this comment

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

sounds good

layout,

/*
* Public attributes.
Copy link
Member

Choose a reason for hiding this comment

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

same, can we drop this and just use @private/@public for doc

@@ -21,6 +27,8 @@ export default Component.extend({
*/
action: null,

type: 'button',
Copy link
Member

Choose a reason for hiding this comment

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

can we list above for action properties supported...seems some are not supported, mark them as TODO

Copy link
Member Author

Choose a reason for hiding this comment

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

@vladucu I'll do this under a separate PR where I'm going to remove the inconsistencies between using text/content and onAction/action for action hashes 👍

Copy link
Member

@vladucu vladucu left a comment

Choose a reason for hiding this comment

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

looks great man!

Let's merge this and update #86 ...will jump on that right after

class=(if primaryAction "Polaris-Page__MainContent")
}}
{{!--
Create a reusable button component for the primary action if we have one,
Copy link
Member

Choose a reason for hiding this comment

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

👍

@andrewpye andrewpye changed the base branch from update/action-list to update-to-polaris-1.10.2 February 9, 2018 14:01
@andrewpye andrewpye merged commit e5574e7 into update-to-polaris-1.10.2 Feb 9, 2018
@andrewpye andrewpye deleted the update/page branch February 9, 2018 14:01
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.

None yet

2 participants