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

Assembler - Remove blockGap between header/sections/footer in new assembler theme #78097

Closed
miksansegundo opened this issue Jun 13, 2023 · 8 comments
Assignees

Comments

@miksansegundo
Copy link
Collaborator

miksansegundo commented Jun 13, 2023

Related WordPress/gutenberg#51242

What

Remove the block gap only between header/sections/footer in BC3:

  • from the editor
BEFORE AFTER
Image Image
  • from the front
BEFORE AFTER
Image Image

Note that I changed the background color of the site to orange to show the gap.

Why

Because users cannot remove that gap easily.

It can be removed by setting the margin as 0 on each pattern container group. However, this option is not viable because there is a bug that doesn't allow this to work on template parts and the assembler puts the header and footer in template parts.

A downside

Without the gap between patterns, users won't see the following button to add patterns from the canvas:

Image

Users will have to add patterns using the List view options to add before/after:

Image

How

Check first the status of the Gutenberg issue Post Content block adds additional margin one can not remove through the UI because they may remove the gap.

We can add site-wide custom CSS in theme.json or style.css to remove the gap only between header/sections/footer:

  • from the editor
.editor-styles-wrapper :where(.wp-site-blocks) > * {
    margin-block-start: 0;
    margin-block-end: 0;
}
  • from the front
:where(.wp-site-blocks) > * {
    margin-block-start: 0;
    margin-block-end: 0;
}
  • from the assembler will also remove this gap, we use the variable --pattern-large-preview-block-gap.
@miksansegundo
Copy link
Collaborator Author

What do you think about this solution? @alaczek @Automattic/lego

@alaczek
Copy link
Contributor

alaczek commented Jun 16, 2023

Would your solution leave the gap between patterns (within the homepage section) or did we take care of that already?

@miksansegundo
Copy link
Collaborator Author

Yes, this solution removes the gap between the first-level patterns, including between homepage sections.

@miksansegundo
Copy link
Collaborator Author

@arthur791004, just a note for checking that we load these styles in the assembler from the new theme when it's done.

For now, we have the blockGap added manually on the large preview.

@miksansegundo miksansegundo changed the title Assembler - Remove blockGap between header/sections/footer in BC3 theme Assembler - Remove blockGap between header/sections/footer in new assembler theme Jun 20, 2023
@miksansegundo
Copy link
Collaborator Author

About removing the gap between the first-level elements with CSS from Creatio theme.

Here is the current structure of the homepage created with the assembler:

  • <header>
  • --- gap ---
  • <main>section/section/...</main>
  • --- gap ---
  • <footer>

Here are the tasks to make it work in all previews (assembler, editor, and site front):

  • Add the CSS mentioned in the issue to Creatio style.css to remove the gap in the editor canvas and the front of the site.
  • Detect when the assembler is using Creatio to remove the gap in the large preview

The assembler adds the gap to the header and footer using a variable so it's easy to update.

It'd be better to make it dynamic instead of detecting Creatio to apply this hack in the large preview but we are limited here because we don't use a single iframe with all patterns in the preview. Therefore, I suggest taking the easy path here and iterating later.

@alaczek
Copy link
Contributor

alaczek commented Jul 13, 2023

Hey Miguel! I added the code to Creatio here: Automattic/themes#7237

@miksansegundo
Copy link
Collaborator Author

Thanks Ola, I'll test it soon and update the assembler hack to make sure it works fine.

@alaczek
Copy link
Contributor

alaczek commented Jul 21, 2023

It actually doesn't :| The gap is only removed in the site preview, but not in the editor or the assembler.

image image image

This seems to be because our rule from style.css is being overridden:
image

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

No branches or pull requests

2 participants