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

Add group variation for full block link #833

Merged
merged 1 commit into from
May 24, 2022
Merged

Add group variation for full block link #833

merged 1 commit into from
May 24, 2022

Conversation

Inwerpsel
Copy link
Contributor

@Inwerpsel Inwerpsel commented Apr 20, 2022

Description

This should work well on any block that can use position: relative, and as long as the link is not within a block with position: relative inside the container.

A drawback about this method is a block can only have 1 block style at a time. I have another PR that uses block styles to add padding on the same blocks. The only way to use styles for more things is to add 1 style for every possible combination. For more than 2 things that would probably get out of hand.

A possible alternative is to create a variation of the core group block, similar to the new "row" block, which has this CSS. That would make it much more obvious what's happening than a style. That also frees up the block styles for actual styles.

I ended up using a variation because styles are already used for padding and equally spacing inside groups. A nice plus of the variation is that it shows up with the variation name, also in the block list.

Screenshot from 2022-05-03 11-08-24

Testing

Example: https://www-dev.greenpeace.org/test-phoebe/expanded-link-block/

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 20, 2022
/unhold d3e098b6-b0c6-4486-9e10-fe102f6b8dcf
@planet-4
Copy link
Contributor

planet-4 commented Apr 20, 2022

Test instance is ready 🚀

🌑 phoebe | admin | blocks report | CircleCI | composer-local.json

⌚ 2022.05.24 12:11:23

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 20, 2022
/unhold 17c84291-0051-476a-98e3-c3e40a34f8f9
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 20, 2022
/unhold d3eaa399-f9f4-4c85-aa77-b914b2cdf781
@Inwerpsel Inwerpsel requested a review from mleray April 21, 2022 07:49
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 21, 2022
/unhold 5ee696f2-e55d-4259-a57a-5ab99c6e2d6b
mleray
mleray previously requested changes Apr 21, 2022
Copy link
Contributor

@mleray mleray left a comment

Choose a reason for hiding this comment

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

This doesn't work for external links, because they also use the ::after pseudo-element 😕 Also it looks weird in this case:
Screenshot 2022-04-21 at 10 31 13

@mleray
Copy link
Contributor

mleray commented Apr 21, 2022

Looks like it will also be an issue for PDF links

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 21, 2022
/unhold 6d228352-2e08-4b51-81a9-83f7417c001a
@Inwerpsel
Copy link
Contributor Author

Inwerpsel commented Apr 21, 2022

This doesn't work for external links, because they also use the ::after pseudo-element confused Also it looks weird in this

I made it use :before instead, which preserves both special link styles.

However neither of them look particularly well inside of the block on the example page (though they might in others).

Could make sense to disable these styles on links that are expanded? I guess we can also follow up on this once somebody starts using a external/pdf link.

@mleray
Copy link
Contributor

mleray commented Apr 21, 2022

Could make sense to disable these styles on links that are expanded? I guess we can also follow up on this once somebody starts using a external/pdf link.

I agree that it makes sense to remove them in this case, since we already don't show them in headings for example. 🤔 Ideally we would check that before adding the classes in JS, but that can be done in a follow-up!

@mleray
Copy link
Contributor

mleray commented Apr 21, 2022

I see that with this implementation since we still add the external link class, we also add a title, not sure if that's an issue 🤔
Screenshot 2022-04-21 at 11 01 07

@Inwerpsel
Copy link
Contributor Author

Inwerpsel commented Apr 21, 2022

we also add a title, not sure if that's an issue

Well it's still accurate, but maybe it doesn't look that great in some cases. Let's get back to it once we get more feedback?

@Inwerpsel
Copy link
Contributor Author

Inwerpsel commented Apr 21, 2022

Ideally we would check that before adding the classes in JS

In fact, ideally we wouldn't even be doing this in JS, but server side. Doing it in JS gives the browser more work and causes re-rendering during page load.

Your point still stands, though, we should just not add the external links class when we don't need it 👍

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request Apr 25, 2022
/unhold 104cd0d5-0c69-4313-b57e-70855394e27b
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 3, 2022
/unhold 9c8f69c7-8591-46bf-a824-79035d71401e
@Inwerpsel Inwerpsel changed the title Add style to make a link cover a container Add group variation for full block link May 3, 2022
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 3, 2022
/unhold 9fce4c48-d0df-4d9c-9765-e2475eae0f2e
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 3, 2022
/unhold fae1902b-35f7-4772-9989-af96fd770520
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 4, 2022
/unhold 18ee1b4e-ef37-4981-8225-05b45c20ac1c
@Inwerpsel Inwerpsel marked this pull request as ready for review May 9, 2022 13:43
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 16, 2022
/unhold bcd75b4f-f2e6-40ab-9fae-d4f6d69dc748
@mleray mleray added UAT Passed User Acceptance Tests passed and removed UAT needed This PR requires User Acceptance Tests before merge labels May 17, 2022
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 17, 2022
/unhold 7e035eb3-f593-4d8b-8c47-ab524c424c85
@mleray
Copy link
Contributor

mleray commented May 17, 2022

Is there a clickable way to revert the expanding link ? I can't unselect it once selected on a grouo. I'm a bit confused on how to use/test it, the example has expanding link in columns, but the style is added to core/group so I can only use it on group/row

It is added as a variation of the Group block, so it's used as such. In the example I've added a Columns block and within each column I've added an Expanded Link, that's the way to do it! Not ideal, but I don't really see how else we can do 😕
Good point about reverting it, I also can't figure it out 😅 Will look into it!

Also, Houssam spotted this Bootstrap functionality which does exactly what we want, maybe we could use that instead of adding custom CSS, but I don't see how to do it without JS so maybe it's not better 🤔

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 17, 2022
/unhold 9594d556-d42c-4596-b8d1-025ab30e1e40
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 17, 2022
/unhold 33279bb4-b3b7-4ad0-b8c9-274a5f486cf5
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 17, 2022
/unhold c1748b4a-28a7-4080-8a92-2fc4815c0b8c
@mleray
Copy link
Contributor

mleray commented May 17, 2022

@lithrel the only way I found to "revert" the variation is by removing the corresponding CSS class from the Additional CSS class(es) in the sidebar, in the Advanced tab

planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 19, 2022
/unhold a4e49549-7ceb-4d2e-bed4-1af9ae91f82c
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 19, 2022
/unhold 85142ac8-50fd-4795-ae54-c73fd7631dd0
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 19, 2022
/unhold a2b7d045-c9b4-4ede-8f85-81a6cf372868
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 19, 2022
/unhold e4c2f3f5-f9d8-4d6a-86d4-10036b0a2edb
@mleray mleray removed their request for review May 23, 2022 08:59
Copy link
Contributor

@lithrel lithrel left a comment

Choose a reason for hiding this comment

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

👍

* Use first link inside the block and expand it to full width/height
* Give separate editor styles: a dashed border round the block to show the clickable area.
* Prevent conflict with pdf and external link styles, by using :before instead of :after.
planet-4 added a commit to greenpeace/planet4-test-phoebe that referenced this pull request May 24, 2022
/unhold 1a9407a8-98c0-477c-aae8-3f23cc596bb8
@mleray mleray merged commit 7e2d5a5 into master May 24, 2022
@mleray mleray deleted the link-container branch May 24, 2022 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review [Test Env] phoebe UAT Passed User Acceptance Tests passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants