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

Framework: Create new <SitesDropdown> component. #379

Merged
merged 10 commits into from
Dec 14, 2015
Merged

Conversation

mtias
Copy link
Member

@mtias mtias commented Nov 21, 2015

This should replace all usages of "me/select-site" and standardize all site selection with our core picker patterns.

ed0199c2-8a11-11e5-9e81-b9c2dc7fed68

To-do

  • Highlight selected site in list.
  • Handle onSelect actions.
  • Testing.

@artpi
Copy link
Contributor

artpi commented Nov 25, 2015

I know this is in progress, so just dropping it here:

Uncaught ReferenceError: postsBase is not defined

While going to http://calypso.localhost:3000/stats/day/[site]

@mtias
Copy link
Member Author

mtias commented Dec 9, 2015

Added example in devdocs for testing:

image

@mtias mtias added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Dec 9, 2015
@artpi
Copy link
Contributor

artpi commented Dec 9, 2015

Ok, seems good :)
🐑 and 🚢

@folletto
Copy link
Contributor

folletto commented Dec 9, 2015

Tested on Chrome, Firefox, Safari, Edge, IE11.

Notes:

  1. When there are multiple items (more than available space), we need to make sure that the last item is cut in half to hint that scrolling is possible. I missed this bit in the mockups.
  2. The dropdown seems pushing the content down instead of being "over" the content. Is that just a side effect in the documentation page?
  3. The chevron seems misaligned: with top: 21px seems v-centering it.
  4. On IE11 it's showing the update icon, overlapping the chevron (screenshot).
  5. I found odd when searching that the item already selected didn't show up. However I'm not sure here. Just raising the point. I think I expected it to show.
  6. Can we animate the chevron? transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease-in;

That's all. Interaction wise (open / close / site display / search) works.

@folletto folletto added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 9, 2015
@mtias
Copy link
Member Author

mtias commented Dec 10, 2015

@folletto thanks for the feedback!

When there are multiple items (more than available space), we need to make sure that the last item is cut in half to hint that scrolling is possible. I missed this bit in the mockups.

I don't think we need to do this right now. It's using vh units so you can make the most use of the screen.

The dropdown seems pushing the content down instead of being "over" the content. Is that just a side effect in the documentation page?

Made it overflow in 7ad7e49

On IE11 it's showing the update icon, overlapping the chevron (screenshot).

That's not just IE, it's everywhere, will disable the indicator for it :)

I found odd when searching that the item already selected didn't show up. However I'm not sure here. Just raising the point. I think I expected it to show.

I think it's fine and consistent — since search applies to what's below, and your selected site is at the top.

Can we animate the chevron? transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease-in;

Done. Though the animation seems a bit frantic to me.

@mtias mtias added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels Dec 10, 2015
@folletto
Copy link
Contributor

I think it's fine and consistent — since search applies to what's below, and your selected site is at the top.

Thing is, I expect the site to be below too. ;)

Dropdowns don't remove the element that's picked. It's a standard behaviour. I just noticed now that the selected one isn't in the list. Should be.

Ok. Tested in Chrome / Firefox, all the above are fixed. Just... a tiny z-index matter:

screen shot 2015-12-10 at 17 45 48

@mtias
Copy link
Member Author

mtias commented Dec 10, 2015

Thing is, I expect the site to be below too. ;)

That's v2!

Dropdowns don't remove the element that's picked. It's a standard behaviour. I just noticed now that the selected one isn't in the list. Should be.

That's what we talked about 😧 " It's probably superfluous given it's also at the top, eh?" so now the selected site is hidden from the list.

@folletto
Copy link
Contributor

I thought we were talking about the highlight of the currently selected
item (gray background) not removing it entirely :)

Davide ‘Folletto’ Casali
AUTOMATTIC

@seear
Copy link
Contributor

seear commented Dec 11, 2015

The old /me/select-site component allows a filtered list of sites to be specified, which /design uses to filter out Jetpack sites. That could be added in #1483.

@seear
Copy link
Contributor

seear commented Dec 11, 2015

Code looks good 👍

I checked out the devdocs example before reading any of the PR discussion and did think for a moment that it was using a cutdown list of only 3 sites:
screen shot 2015-12-11 at 11 45 35

@ockham
Copy link
Contributor

ockham commented Dec 11, 2015

As a consumer of this component, how can I find out which site was actually selected?

@ockham
Copy link
Contributor

ockham commented Dec 11, 2015

(I'm asking because I can't seem to see an easy way. Maybe selectSite() should accept a prop function to which the args of SiteSelector#onSiteSelect, i.e. siteSlug and event are passed?)

@mtias
Copy link
Member Author

mtias commented Dec 11, 2015

@mtias
Copy link
Member Author

mtias commented Dec 11, 2015

What you said :)

@ockham ockham added [Status] Needs Author Reply [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs Author Reply labels Dec 11, 2015
@ockham
Copy link
Contributor

ockham commented Dec 11, 2015

Pushed 71451cf to #1483 -- feel free to cherry-pick :-)

},

getSelectedSite() {
return sites.getSite( this.state.selected ) || sites.getPrimary();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the || sites.getPrimary() part? Since getInitialState() sets this.state.selected and falls back to sites.getPrimary().slug, we should be fine without, no?

(This is going to be more relevant once we add filtering.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think we should be fine without it.

This should replace all usages of "me/select-site" and
standardize all site selection with our core picker patterns.
Pass site slug onSiteSelect as the prop callback.
- Move all basic styles to site-selector.
- Move all the sidebar specific styling under the sidebar namespace.
- Clean up resets in sites-popover.
- Add a "hideSelected" prop that allows hiding the selected site from the list.
- If not set, the site is shown and highlighted.
@mtias
Copy link
Member Author

mtias commented Dec 14, 2015

@ockham thanks for the review. How is it looking now? I think we can merge and add the filtering later on when you actually need to use it in #1483.

@ockham
Copy link
Contributor

ockham commented Dec 14, 2015

👍

@ockham ockham added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 14, 2015
@mtias
Copy link
Member Author

mtias commented Dec 14, 2015

Will squash a couple commits.

Animate chevron icon when opening.

Disable site-indicator in dropdown header.
props @ockham.

Avoid redundand getPrimary() call.
mtias added a commit that referenced this pull request Dec 14, 2015
Framework: Create new <SitesDropdown> component.
@mtias mtias merged commit cb701c2 into master Dec 14, 2015
@mtias mtias deleted the add/sites-dropdown branch December 14, 2015 13:47
left: -272px;
width: 272px;
overflow: hidden;
z-index: 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add this to z-index map?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants