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

Make nav components more atomic #2

Closed
wants to merge 7,251 commits into from
Closed

Conversation

joshuatf
Copy link
Collaborator

Description

Breaks down nav components into smaller pieces so that the nav itself is more customizable.

This is in need of testing and there are still some outstanding issues with accessibility, but prefer to handle these in follow-ups to keep the scope of this PR down.

This PR tries to strike a balance between flexibility and ease of use. I think in keeping this component as presentational as possible, it would be ideal to have the consumer map over and use navigational components directly:

<NavigationMenu>
  <NavigationMenuItem
    onClick={ ... }
  >
     Menu Item
  </NavigationMenuItem>
<NavigationMenu />

instead of passing an array of items:

<Navigation active={ active } items={ items }>
  <NavigationMenu />
</Navigation>

However, using the former option means putting more responsibility on the consumer to filter the array of items. Open to feedback here and whether or not there's a way to improve this.

Screenshots

Screen Shot 2020-07-28 at 6 08 57 PM

Testing

  1. Run npm run storybook:dev
  2. Check the Navigation component.
  3. Check that items are rendered, navigation, and back buttons work, and the navigation title shows the correct title.

talldan and others added 30 commits July 3, 2020 14:34
…ordPress#21075)

* Extract Navigation Link block rendering from Navigation

Move code around with TODOs where needed

Migrate away from block.json

Filter out empty blocks

Minor tweaks

Add navigation link to core dynamic block types

Temporarily comment out code in nav-link block that is coupled to nav block

Minor fixes

Actually render the inner blocks

This is probably fine

Render nav link inner blocks in a <ul>

Make the Show Submenu Icon feature work using CSS

Ensure default attributes work correctly on nav and nav link blocks

Fix has-submenu-icon classname application in render function

Make color styles inherit

Move navigation link styles to the navigation link style.scss

Fix & being used in base level style

Remove TODO that has now been TODONE

Fix PHP linting

Update navigation link snapshot test

Fix PHP doc block comments

Co-Authored-By: Robert Anderson <[email protected]>

* Render navigation-link from block.json

* Migrate some navigation-link styles from navigation

* Fix copy/pasted function name

* Navigation: Use render_callback instead of render_block hook

* Navigation: Use block context when rendering a Link

* Navigation: Remove core/ prefix from context attribute names

* Navigation: Remove .has-submenu-icon

* Navigation: Fix failing integration test

* Navigation: Fix submenu icon appearance

Co-authored-by: Robert Anderson <[email protected]>
* Retire $radius-round-rectangle

* Retire dark-gray-900

* Retire dark-gray-800

* Rename new colors to be on a scale.

* Rename a variable, retire blue medium 100.

* Retire light-gray-100

* Make all grays neutral.

* Retire light-gray-200

* Retire light-gray-300.

* Replace light-gray-400

* Retire light gray 500, update borders.
…ing applied to dragged block (WordPress#23638)

* Fix invisible drop target indicator caused by is-drop-target class being applied to dragged block

* Update tests

* Update comment
* add pullquote tranformations

This will be refactored.

* leave raw transformation to be handled by Quote only

* fix e2e tests

* merge quote/pullquote tranforms from list
…ordPress#23439)

* Throw error if we have an issue registering blocks.

* Remove empty newline.

* Try out more error handling.

* Add typerror.

* Slight refactor.

* Add `isInstallable` property to disable the Add button on blocks with fatal errors

* Update the copy of error messages

* Remove variable abbreviation.

* Move the state shape from action to reducer.

* Fix broken tests.

* Fix typo in test.

* Fix margin bottom for content.

Co-authored-by: Kelly Dwan <[email protected]>
…3654)

* Update with review suggestions

* Text edits, linting, and typos

	- Add shell language
	- Add block.json info about properties

* Update with review suggestions

* Package lock update
* Release: WordPress 5.5 beta 1 finishing touches

* Add patterns ticket

* Update client-assets.php

Co-authored-by: Riad Benguella <[email protected]>
WordPress#23600)

* Add "engines" to the package.json and "engine-strict = true" to the .npmrc

* Add "npm": ">=6.9.0" to npm-engines

* Change engines: node to >=10.0.0 according to check-engines

* Remove obsolete npm-scripts which check engines
* Scripts: Fix build script with style.css files

* Docs: Add entry to `@wordpress/scripts` changelog file
…ipt (WordPress#23711)

* Scripts: Exclude node_modules from source map processing in build scripts

* Docs: Add note in @wordpress/scripts changelog about fix
…WordPress#22668)

* Add inline styles for font-sizes in the editor

* Fix subscription

* Avoid new BlockListBlock instance

Co-authored-by: Ella van Durpe <[email protected]>
…#23688)

* Block Directory: Return inactive plugins with block directory results

* Active a an inactive block plugin if we see a plugin URL

The plugin URL will only exist if the plugin is already installed, so we can use that to activate that plugin. We can also use this link for uninstallation, so we make sure to add it into the block object when installing a plugin.

* Add links to mocked plugin response

* Fix mocked test data

* Fix notice in install test
* Mobile - Buttons block - Use same logic to insert blocks as the inserter menu

* Correct EmptyListComponent to avoid empty space after cutting block

Co-authored-by: lukewalczak <[email protected]>
Addison-Stavlo and others added 15 commits July 23, 2020 11:49
…ings. (WordPress#24080)

* update block.json

* add textAlign in editor

* update wront context check / warnings

* allow comment html (links) to render in editor

* link colors to work in editor

* link colors to register on front end

* remove check for postType

* update editor rendering of comments
* Updates content and style, also adds a description

* Update test snapshot
* Release script: Update react-native-editor version to 1.33.0

* Update release notes.

* Update version numbers for packages.

* Revert "Reduce spacing between label and slider control (WordPress#23580)" (WordPress#24109)

This reverts commit 2a67de0.

Co-authored-by: Antonis Lilis <[email protected]>
* Updates content and style, also adds a description

* Increase viewportWidth for better preview

* Add missing newline character
* Updates content and style, also adds a description

* Fix double quotes error
* i18n: Merge similar translation strings in rss block

Moved from https://core.trac.wordpress.org/ticket/50739

* Add translation comment
* Updates contents and style, also adds a description

* Fix double arrow aligments

* Remove duplicate lines
* Updates content and style, also adds a description

* Remove unnecessary double quotes
* Adds 'Heading and paragraph' pattern

* Update layout of chapter and heading. Also description to reflect the change.

* Fix code spacing issues
* Add a description and icon to the Post Tags block
* Add a description to the Post Title block.
* Added postTitle icon
* Updates content, style and title, also adds a description

* Update gradient starting color

* Update contents of pattern and changed filename, title and description accordingly

* Fix double quotes issue
@joshuatf joshuatf self-assigned this Jul 28, 2020
* Initial working tree display

* add styles

* add styles

* dark theme

* back button

* secondary

* BEM style classnames

* remove back button styles

* add menu: 'primary' data propery

* get even more working

* remove extra styles

* add README

* manifest
@psealock
Copy link
Owner

Lots of good things happening here. I also happened to remove state in WordPress#24255, but happy to go with this one if it makes sense.

Could you fork Gutenberg and create a new PR on the Gutenberg repo so its visible? The feature/navigation branch is up to date with this one since WordPress#24107 has been merged. That will be better place for a full review.

@joshuatf joshuatf force-pushed the update/separate-components branch from d602b75 to 3444b29 Compare July 29, 2020 12:31
@joshuatf joshuatf changed the base branch from add/navigation-component to master July 29, 2020 12:32
@joshuatf
Copy link
Collaborator Author

PR opened at WordPress#24266

@joshuatf joshuatf closed this Jul 29, 2020
@github-actions
Copy link

Size Change: -21 B (0%)

Total Size: 1.15 MB

Filename Size Change
build/components/style-rtl.css 15.7 kB -12 B (0%)
build/components/style.css 15.7 kB -9 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.min.js 1.14 kB 0 B
build/annotations/index.min.js 3.67 kB 0 B
build/api-fetch/index.min.js 3.43 kB 0 B
build/autop/index.min.js 2.82 kB 0 B
build/blob/index.min.js 620 B 0 B
build/block-directory/index.min.js 7.63 kB 0 B
build/block-directory/style-rtl.css 953 B 0 B
build/block-directory/style.css 952 B 0 B
build/block-editor/index.min.js 125 kB 0 B
build/block-editor/style-rtl.css 10.8 kB 0 B
build/block-editor/style.css 10.8 kB 0 B
build/block-library/editor-rtl.css 7.63 kB 0 B
build/block-library/editor.css 7.63 kB 0 B
build/block-library/index.min.js 132 kB 0 B
build/block-library/style-rtl.css 7.83 kB 0 B
build/block-library/style.css 7.83 kB 0 B
build/block-library/theme-rtl.css 728 B 0 B
build/block-library/theme.css 729 B 0 B
build/block-serialization-default-parser/index.min.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.min.js 3.1 kB 0 B
build/blocks/index.min.js 48.3 kB 0 B
build/components/index.min.js 200 kB 0 B
build/compose/index.min.js 9.68 kB 0 B
build/core-data/index.min.js 11.5 kB 0 B
build/data-controls/index.min.js 1.29 kB 0 B
build/data/index.min.js 8.45 kB 0 B
build/date/index.min.js 5.38 kB 0 B
build/deprecated/index.min.js 772 B 0 B
build/dom-ready/index.min.js 568 B 0 B
build/dom/index.min.js 3.23 kB 0 B
build/edit-navigation/index.min.js 10.8 kB 0 B
build/edit-navigation/style-rtl.css 1.08 kB 0 B
build/edit-navigation/style.css 1.08 kB 0 B
build/edit-post/index.min.js 304 kB 0 B
build/edit-post/style-rtl.css 5.61 kB 0 B
build/edit-post/style.css 5.61 kB 0 B
build/edit-site/index.min.js 16.9 kB 0 B
build/edit-site/style-rtl.css 3.06 kB 0 B
build/edit-site/style.css 3.06 kB 0 B
build/edit-widgets/index.min.js 9.37 kB 0 B
build/edit-widgets/style-rtl.css 2.45 kB 0 B
build/edit-widgets/style.css 2.45 kB 0 B
build/editor/editor-styles-rtl.css 537 B 0 B
build/editor/editor-styles.css 539 B 0 B
build/editor/index.min.js 45.3 kB 0 B
build/editor/style-rtl.css 3.78 kB 0 B
build/editor/style.css 3.78 kB 0 B
build/element/index.min.js 4.65 kB 0 B
build/escape-html/index.min.js 733 B 0 B
build/format-library/index.min.js 7.72 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.min.js 2.13 kB 0 B
build/html-entities/index.min.js 621 B 0 B
build/i18n/index.min.js 3.56 kB 0 B
build/is-shallow-equal/index.min.js 711 B 0 B
build/keyboard-shortcuts/index.min.js 2.51 kB 0 B
build/keycodes/index.min.js 1.94 kB 0 B
build/list-reusable-blocks/index.min.js 3.12 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.min.js 5.33 kB 0 B
build/notices/index.min.js 1.79 kB 0 B
build/nux/index.min.js 3.4 kB 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.min.js 2.56 kB 0 B
build/primitives/index.min.js 1.4 kB 0 B
build/priority-queue/index.min.js 789 B 0 B
build/redux-routine/index.min.js 2.85 kB 0 B
build/rich-text/index.min.js 13.9 kB 0 B
build/server-side-render/index.min.js 2.71 kB 0 B
build/shortcode/index.min.js 1.7 kB 0 B
build/token-list/index.min.js 1.27 kB 0 B
build/url/index.min.js 4.06 kB 0 B
build/viewport/index.min.js 1.85 kB 0 B
build/warning/index.min.js 1.14 kB 0 B
build/wordcount/index.min.js 1.17 kB 0 B

compressed-size-action

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.