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

Blocks: Create a stub Download Modal "block" #106

Merged
merged 2 commits into from
Aug 26, 2022

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Aug 25, 2022

This moves the download modal code into a subfolder in src, so that we can create additional blocks without needing a custom webpack.config.js. By default, wp-scripts will look in the src folder for any block.json files, and pull out the scripts referenced. We can use that behavior without creating a proper block by adding a block.json file with just the script. This "block" is not registered anywhere, and the JS is still enqueued the same way it was before.

Other blocks can be added as sibling folders to download, and they'll automatically be built too.

See #52 — eventually this will be a real block, so this won't be a workaround forever.

Screenshots

No visual changes.

How to test the changes in this Pull Request:

  1. Build the project yarn workspace wporg-main-2022-theme build
  2. It should generate new files inside build/download
  3. Load the download page
  4. The script should load
  5. The modal should open on click

@ryelle ryelle added the [Component] Blocks Custom blocks or block variations label Aug 25, 2022
@ryelle ryelle requested a review from adamwoodnz August 25, 2022 17:51
@ryelle ryelle self-assigned this Aug 25, 2022
import DownloadModal from './DownloadModal';
import DownloadModal from './download-modal';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed this file to follow the WP coding standards: files should be lowercase, words separated with hypens.

Copy link
Contributor

@adamwoodnz adamwoodnz left a comment

Choose a reason for hiding this comment

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

:shipit: Works for me

I just added 1 commit to simplify the init code a little

@ryelle ryelle merged commit 67f8be9 into trunk Aug 26, 2022
@ryelle ryelle deleted the update/download-modal-block branch August 26, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Blocks Custom blocks or block variations
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants