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

Add very basic template information dropdown #25757

Merged
merged 11 commits into from
Oct 9, 2020

Conversation

noahtallen
Copy link
Member

@noahtallen noahtallen commented Oct 1, 2020

Description

Adding a very basic foundation to iterate on for the template info dropdown.

How has this been tested?

Locally, in edit site.

Screenshots

Screen Shot 2020-10-07 at 11 57 53 AM

Types of changes

New feature.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions
Copy link

github-actions bot commented Oct 1, 2020

Size Change: +568 B (0%)

Total Size: 1.19 MB

Filename Size Change
build/block-editor/index.js 130 kB +10 B (0%)
build/block-library/index.js 145 kB +7 B (0%)
build/blocks/index.js 47.6 kB +1 B
build/components/index.js 169 kB +37 B (0%)
build/data/index.js 8.6 kB -3 B (0%)
build/edit-navigation/index.js 10.6 kB -1 B
build/edit-site/index.js 21.3 kB +361 B (1%)
build/edit-site/style-rtl.css 3.8 kB +76 B (1%)
build/edit-site/style.css 3.81 kB +80 B (2%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.52 kB 0 B
build/api-fetch/index.js 3.35 kB 0 B
build/autop/index.js 2.72 kB 0 B
build/blob/index.js 668 B 0 B
build/block-directory/index.js 8.55 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/style-rtl.css 11 kB 0 B
build/block-editor/style.css 11 kB 0 B
build/block-library/editor-rtl.css 8.65 kB 0 B
build/block-library/editor.css 8.65 kB 0 B
build/block-library/style-rtl.css 7.66 kB 0 B
build/block-library/style.css 7.66 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-default-parser/index.js 1.78 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 9.43 kB 0 B
build/core-data/index.js 12 kB 0 B
build/data-controls/index.js 685 B 0 B
build/date/index.js 31.9 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.29 kB 0 B
build/edit-post/style.css 6.28 kB 0 B
build/edit-widgets/index.js 21.2 kB 0 B
build/edit-widgets/style-rtl.css 3.02 kB 0 B
build/edit-widgets/style.css 3.02 kB 0 B
build/editor/editor-styles-rtl.css 492 B 0 B
build/editor/editor-styles.css 493 B 0 B
build/editor/index.js 45.5 kB 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/editor/style.css 3.84 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 734 B 0 B
build/format-library/index.js 7.49 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.54 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.39 kB 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/index.js 3.02 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/media-utils/index.js 5.13 kB 0 B
build/notices/index.js 1.69 kB 0 B
build/nux/index.js 3.27 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.44 kB 0 B
build/primitives/index.js 1.34 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 13 kB 0 B
build/server-side-render/index.js 2.6 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.74 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

Copy link
Contributor

@Addison-Stavlo Addison-Stavlo 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 like a great starting point!

I also am digging that anchorRect, I didn't notice that was a thing previously. 😁

@noahtallen noahtallen force-pushed the try/template-info-dropdown branch from 63c35c9 to 96cdaef Compare October 2, 2020 22:56
@noahtallen noahtallen force-pushed the try/template-info-dropdown branch 2 times, most recently from 30e1caa to 27790ca Compare October 7, 2020 01:34
@@ -0,0 +1,7 @@
.edit-site-template-details__label {
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 feel like there should be existing styles for this somewhere 🤔

@noahtallen noahtallen marked this pull request as ready for review October 7, 2020 01:46
@noahtallen noahtallen changed the title Try/template info dropdown Add very basic template information dropdown Oct 7, 2020
Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

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

Two things I've noticed while testing:

  1. There is no margin between the title and button border when dropdown is selected.

Screenshot 2020-10-07 at 13 56 58

  1. The template title is now displaced to the left a bit, so when we select the template part and show its title there, the animation is not as good. Previously it was just sliding up, but now there is also the initial jump to the right too. I'm thinking that we could show the chevron when template part is selected too, but just update the content/context of the dropdown?

<p className="edit-site-template-details__heading">
{ __( 'Template details' ) }
</p>
<p>{ `${ __( 'Name' ) }: ${ template.slug }` }</p>
Copy link
Member

Choose a reason for hiding this comment

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

We should link this to corresponding item in navigation sidebar. Clicking on it should open the menu and activate the item. This is fine to do in a follow-up though.

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, I see. That makes sense, I vote to do it in a follow-up :)

@noahtallen noahtallen force-pushed the try/template-info-dropdown branch from fd85e84 to a1b5d23 Compare October 7, 2020 18:35
@noahtallen
Copy link
Member Author

There is no margin between the title and button border when dropdown is selected.

Added a bit of margin to fix that:

Screen Shot 2020-10-07 at 11 42 33 AM

I'm thinking that we could show the chevron when template part is selected too, but just update the content/context of the dropdown?

I think the designs so far have been to avoid this. 🤔 Unless we add the dropdown while the template part is selected, there's no way to avoid the jump. I don't think there is any extra context we could show -- I'd think the dropdown would still be beside the template name, and shouldl still show template info

@noahtallen
Copy link
Member Author

noahtallen commented Oct 7, 2020

cc @david-szabo97 in e52fe395a0f48682aaf2fc8b8de61c327347255e, I refactored the template information calculation so we can reuse it. The only weird thing is that I'm unsure where to put the constants file now.

Copy link
Contributor

@jeyip jeyip left a comment

Choose a reason for hiding this comment

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

Tested in Chrome, Safari, Edge, IE11, and Firefox:

  • Template switching with the navigation sidebar and noting that the label changes appropriately
  • Template details are correct
  • Template part labels change appropriately

+1 when we resolve the discussion about specs 🙂

@noahtallen noahtallen force-pushed the try/template-info-dropdown branch from 94d3f14 to a47a474 Compare October 9, 2020 20:19
Copy link
Contributor

@Addison-Stavlo Addison-Stavlo left a comment

Choose a reason for hiding this comment

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

This all looks good and works well for me!

Im just wondering about the dropdown not being usable after a template-part is selected. Was this how design wanted it or was that more unspecified?

Copy link
Contributor

@Addison-Stavlo Addison-Stavlo left a comment

Choose a reason for hiding this comment

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

Looks like that is as designed. Nice job here! 🎉

Copy link
Contributor

@jeyip jeyip left a comment

Choose a reason for hiding this comment

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

It looks like Github has degraded performance. Feel free to merge when your new commit is received by the platform 😅

@noahtallen noahtallen force-pushed the try/template-info-dropdown branch from af34640 to 8a26fed Compare October 9, 2020 22:23
@noahtallen noahtallen merged commit c761c4c into master Oct 9, 2020
@noahtallen noahtallen deleted the try/template-info-dropdown branch October 9, 2020 22:56
@github-actions github-actions bot added this to the Gutenberg 9.2 milestone Oct 9, 2020
@vindl
Copy link
Member

vindl commented Oct 10, 2020

Unless we add the dropdown while the template part is selected, there's no way to avoid the jump. I don't think there is any extra context we could show -- I'd think the dropdown would still be beside the template name, and shouldl still show template info

Can we then preserve the dropdown while template part is selected, but still show the same info?

@noahtallen
Copy link
Member Author

Can we then preserve the dropdown while template part is selected, but still show the same info?

yeah, we definitely can do that fairly easily, just a matter of design :) cc @shaunandrews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants