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

Business Hours: Add color, typography, spacing & alignment design tools. #22421

Merged
merged 4 commits into from
Jan 28, 2022

Conversation

yansern
Copy link
Contributor

@yansern yansern commented Jan 20, 2022

Changes proposed in this Pull Request:

Add design tools for Business Hours block.

2022-01-27_13-40-08

2022-01-27_13-41-11

Jetpack product discussion

This PR is a part of the Expanding Jetpack Block design tooling for Full Site Editing project: pdDOJh-1P-p2 & pdDOJh-6-p2

Does this pull request change what data or activity we track or use?

No, it does not.

Testing instructions:

  1. Add "Business Hours" block on the editor.
  2. On the Block Inspector sidebar, you should see:
    • Color (Text, Background with Gradient option in the color picker)
    • Typography (Size & Line Height option)
    • Dimensions (Padding & Margin option)
  3. On the Block Toolbar, you should see:
    • Align (Full & Wide align option)
  4. Setting any of the options above should render on the editor and when previewed/published.

Note: Different themes support different style attributes. Some theme suggestions to test on: Quadrat, Geologist, TT1 (Blocks), Seedlet (Blocks).

@yansern yansern added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Block] Business Hours [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jan 20, 2022
@yansern yansern requested a review from a team January 20, 2022 07:38
@yansern yansern self-assigned this Jan 20, 2022
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello yansern! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D73437-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: February 1, 2022.
  • Scheduled code freeze: January 24, 2022.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jan 20, 2022
@ivan-ottinger
Copy link
Contributor

ivan-ottinger commented Jan 21, 2022

I think you are still planning to make changes, but I went ahead and reviewed and tested the current code.


The proposed changes work as expected:

Markup on 2022-01-21 at 15:36:56

Also, the styles are being added on the front-end as expected:

<dl class="jetpack-business-hours has-text-color has-luminous-vivid-amber-color has-background wp-block-jetpack-business-hours" style="background-color: #051a8e; padding-top: 30px; padding-right: 30px; padding-bottom: 30px; padding-left: 30px; margin-top: 50px; margin-right: 50px; margin-bottom: 50px; margin-left: 50px;"> [...] </dl>

One thing that is different when we compare the generated inline style with the style that would have been generated by Gutenberg, is that the Gutenberg-generated style would have no spaces in it, e.g.:

style="background-color:#051a8e;padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px;margin-top:50px;margin-right:50px;margin-bottom:50px;margin-left:50px"

But that's just an observation.


All the failed tests seem to be related to two things:

  • a couple of linting issues (missing spaces and a comma)
  • old tests expecting the block to render without the classes jetpack-business-hours wp-block-jetpack-business-hours instead of current jetpack-business-hours

What's interesting is that by passing

'spacing' => array(
	'margin' => true,
)

to the Blocks::jetpack_register_block() we can make the margin setting display in the block editor. That's a TIL for me (as adding margin to the support in index.js doesn't provide that result on its own).

@yansern
Copy link
Contributor Author

yansern commented Jan 24, 2022

I think you are still planning to make changes, but I went ahead and reviewed and tested the current code.

Yes, I think I'm almost ready. I'm going to drop support for align in this PR because that one requires more work (CSS fixes). Either that or keep this PR open the align CSS fixes are in. Align support for wide & full is in. No CSS fixes needed. Leaving out Left/Center/Right. Not needed for now.

old tests expecting the block to render without the classes jetpack-business-hours wp-block-jetpack-business-hours instead of current jetpack-business-hours

Modified to support both classnames.

What's interesting is that by passing

'spacing' => array(
	'margin' => true,
)

to the Blocks::jetpack_register_block() we can make the margin setting display in the block editor. That's a TIL for me (as adding margin to the support in index.js doesn't provide that result on its own).

Thank you for the observation!

@yansern yansern force-pushed the add/business-hours-block-design-tools branch from a8b7991 to 7f0a145 Compare January 27, 2022 11:14
@yansern yansern changed the title Business Hours: Add support for color & spacing design tools. Business Hours: Add color, typography, spacing & alignment design tools. Jan 27, 2022
@yansern
Copy link
Contributor Author

yansern commented Jan 27, 2022

This is now ready. :)

@yansern yansern added [Status] Needs Team Review and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jan 28, 2022
@ivan-ottinger ivan-ottinger force-pushed the add/business-hours-block-design-tools branch from 9d1986f to 4952c8a Compare January 28, 2022 09:35
@ivan-ottinger ivan-ottinger self-requested a review January 28, 2022 10:47
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

LGTM. 👍🏼

Tested with the following themes: Geologist, Hever, Twenty Twenty, Dara, Seedlet, Twenty Twenty-One and Twenty Twenty-Two.

Also tested on WPCOM sandbox.

@ivan-ottinger ivan-ottinger added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Team Review labels Jan 28, 2022
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This tests well for me. 🚢

@jeherve jeherve added this to the jetpack/10.7 milestone Jan 28, 2022
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Jan 28, 2022
@jeherve jeherve merged commit 046b0d1 into master Jan 28, 2022
@jeherve jeherve deleted the add/business-hours-block-design-tools branch January 28, 2022 11:47
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D73437-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 28, 2022
@ivan-ottinger
Copy link
Contributor

Successfully deployed to WPCOM. Changeset: r239386-wpcom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Business Hours [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants