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

Quadrat: Add alignments for image cover and video #3816

Closed
wants to merge 2 commits into from

Conversation

scruffian
Copy link
Member

Changes proposed in this Pull Request:

In Quadrat we want a gap around the site, but we want image, cover and video blocks to extend into it:
Screenshot 2021-05-10 at 20 53 12

All other blocks should have space around them.

Related issue(s):

#3747

@scruffian scruffian requested a review from a team May 10, 2021 19:53
@scruffian scruffian self-assigned this May 10, 2021
@scruffian scruffian added this to the Quadrat v1 milestone May 10, 2021
@@ -193,8 +197,8 @@
},
"post-content": {
"padding": {
"left": "var(--wp--custom--margin--horizontal)",
"right": "var(--wp--custom--margin--horizontal)"
"left": "0px",
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to look at the impact of this change

@jffng
Copy link
Contributor

jffng commented May 10, 2021

All other blocks should have space around them.

I'm not sure I agree. For example if I have a group or columns block with a different background color, should that extend to the full width of the page?

Screen Shot 2021-05-10 at 5 45 28 PM

@@ -129,6 +129,10 @@
},
"margin": {
"baseline": "10px",
"bodyHorizontal": "0px",
"bodyVertical": "0px",
"bodyHorizontalDesktop": "0px",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned that by adding more custom variables within the theme that are media query specific, we are going down a similar path to alignments that won't be compatible with FSE.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think that these variables should be set by the Site Editor?

Copy link
Contributor

Choose a reason for hiding this comment

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

I rather think they make sense as variables in a theme for re-use, but (IMO) doesn't HAVE to be surfaced to the user (and is unlikely to be a standard way). So they make sense in a child theme, just not BCB. I'm not sure that I'm keen for most of this to be in BCB; it all feels very theme-specific and something unlikely to be handled by gutenberg (thus not something to be handled by BCB).

Copy link
Contributor

@pbking pbking May 20, 2021

Choose a reason for hiding this comment

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

Since we have a standard method of describing padding perhaps it would be better to define this just like any other element. And to take a note from the button hover state refactor, perhaps could also express the mobile 'state' in the same way. i.e.

		"custom": {
			"alignment": {
				"alignedMaxWidth": "50%"
			},
			"body": {
				"spacing": {
					"padding": {
						"top": "0px",
						"bottom": "0px",
						"left": "0px",
						"right": "0px"
					}
				},
				"mobile": {
					"spacing": {
						"padding": {
							"top": "0px",
							"bottom": "0px",
							"left": "0px",
							"right": "0px"
						}
					}
				}
			},

It's more verbose but follows the convention of Gutenberg.

@scruffian
Copy link
Member Author

I'm not sure I agree. For example if I have a group or columns block with a different background color, should that extend to the full width of the page?

@beafialho what do you think?

@beafialho
Copy link
Collaborator

I'd say if a column block has a background color, the best solution is to extend it to the full width of the page. However, if it doesn't have a background color and the columns have text, the problem remains, so I think it should have the margins in this case.

Captura de ecrã 2021-05-12, às 09 35 27

@kjellr what do you think?

@kjellr
Copy link
Contributor

kjellr commented May 14, 2021

That's right. The general rule is: No text should bump up against the edges of the screen.

@pbking
Copy link
Contributor

pbking commented May 19, 2021

To account for that scenario does it make sense to just add a padding to the columns (and group) if it's wide width (background color or not?)

.wp-block-columns.alignfull {
	padding: var(--wp--custom--margin--vertical) var(--wp--custom--margin--horizontal);
}

@kjellr
Copy link
Contributor

kjellr commented May 20, 2021

It gets more complicated than that, because if for example there's a full-width image inside of a columns or group block, we do want it to extend to the edges. It's only text that we want to add padding to.

@scruffian
Copy link
Member Author

scruffian commented May 20, 2021

It gets more complicated than that, because if for example there's a full-width image inside of a columns or group block, we do want it to extend to the edges. It's only text that we want to add padding to.

Are you sure that's a good idea? @beafialho said it was better not to do that with the gallery block because of the spaces between the images:
Screenshot 2021-05-20 at 17 50 42

@kjellr
Copy link
Contributor

kjellr commented May 20, 2021

It's only text and the gallery block that we want to add padding to then. 😄

The priority is text though: when that bumps up against the edges it looks like a bug. When the gallery does, it's more of a design choice.


@include break-mobile {
padding: var(--wp--custom--margin--body-vertical-desktop) var(--wp--custom--margin--body-horizontal-desktop);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Leveraging and then redefining the variables here would allow for other places that use the body padding variables to do so only once (the value of the variable would change based on the breakpoint)

body {
	padding-top: var(--wp--custom--body--padding--top);
	padding-bottom: var(--wp--custom--body--padding--bottom);
	padding-left: var(--wp--custom--body--padding--left);
	padding-right: var(--wp--custom--body--padding--right);

	@include break-mobile-only {
		--wp--custom--body--padding--top: var(--wp--custom--body--mobile--padding--top);		
		--wp--custom--body--padding--bottom: var(--wp--custom--body--mobile--padding--bottom);		
		--wp--custom--body--padding--left: var(--wp--custom--body--mobile--padding--left);		
		--wp--custom--body--padding--right: var(--wp--custom--body--mobile--padding--right);		
	}
}

margin: 0 calc(-1 * var(--wp--custom--margin--body-horizontal-desktop));
width: calc(100% + var(--wp--custom--margin--body-horizontal-desktop)*2);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Redefining variables (as noted below in _body.scss) would eliminate the need for additional breakpoints like this. There would just be one calculation, the value of the variable changing depending on the viewport width.

@scruffian
Copy link
Member Author

Closing in favour of #3953

@scruffian scruffian closed this May 26, 2021
@scruffian scruffian deleted the add/alignments-for-image-cover-and-video branch May 26, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants