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

[RNMobile] Full width columns #25621

Merged
merged 78 commits into from
Dec 18, 2020
Merged

[RNMobile] Full width columns #25621

merged 78 commits into from
Dec 18, 2020

Conversation

lukewalczak
Copy link
Member

@lukewalczak lukewalczak commented Sep 24, 2020

Description

That PR is adding full width (along with different width unit) functionality to Columns block.

How has this been tested?

  1. Open mobile app
  2. Add columns block
  3. Set to full width
  4. Open parent settings and change columns width and units

Expect that columns are equal and always stacked when portrait mode (width < 480)

  1. if device is bigger e.g iPhone 11 or Pro (width > 768) or tablet / iPad

Expect that columns are respecting the passed width when landscape mode

  1. if phone is smaller e.g iPhone 7 (width < 768)

Expect that columns are equal and are max 3 in a row when landscape mode

  1. In one of the column nest another columns block and set it to full width

Expect that nested columns block behaves accordingly to the rules/ breakpoints above

Testing HTMLs

<!-- wp:cover {"customOverlayColor":"#abb8c3","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#abb8c3"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"url":"https://callstackhappiryuhome.files.wordpress.com/2020/09/pexels-photo-1987736.jpg","id":2067,"align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-image:url(https://callstackhappiryuhome.files.wordpress.com/2020/09/pexels-photo-1987736.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"44.4vw"} -->
<div class="wp-block-column" style="flex-basis:44.4vw"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"100rem"} -->
<div class="wp-block-column" style="flex-basis:100rem"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"43.6rem"} -->
<div class="wp-block-column" style="flex-basis:43.6rem"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"44vw"} -->
<div class="wp-block-column" style="flex-basis:44vw"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"7.2px"} -->
<div class="wp-block-column" style="flex-basis:7.2px"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"65.5%"} -->
<div class="wp-block-column" style="flex-basis:65.5%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"1%"} -->
<div class="wp-block-column" style="flex-basis:1%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"9%"} -->
<div class="wp-block-column" style="flex-basis:9%"></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"92%"} -->
<div class="wp-block-column" style="flex-basis:92%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:cover {"customOverlayColor":"#cd2653","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#cd2653"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"65%"} -->
<div class="wp-block-column" style="flex-basis:65%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"33.34%"} -->
<div class="wp-block-column" style="flex-basis:33.34%"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2059,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://callstackhappiryuhome.files.wordpress.com/2020/09/pexels-photo-716398.jpg?w=683" alt="" class="wp-image-2059"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"33.34%"} -->
<div class="wp-block-column" style="flex-basis:33.34%"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2063,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://callstackhappiryuhome.files.wordpress.com/2020/09/pexels-photo-4753879.jpg?w=684" alt="" class="wp-image-2063"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":2061,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://callstackhappiryuhome.files.wordpress.com/2020/09/pexels-photo-4178776.jpg?w=1024" alt="" class="wp-image-2061"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Full width - equal columns widths</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Full width - equal columns widths &lt; 100 %</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Full width - different <strong>columns widt</strong>hs &gt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Full width - one column &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"40%"} -->
<div class="wp-block-column" style="flex-basis:40%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Full width - nesting columns, equal widths</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Full width - nesting columns, widths &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column {"width":"28.3%"} -->
<div class="wp-block-column" style="flex-basis:28.3%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"63.9%"} -->
<div class="wp-block-column" style="flex-basis:63.9%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Wide width - equal columns widths</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - equal columns widths &lt; 100 %</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - different <strong>columns widt</strong>hs &gt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - one column &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"40%"} -->
<div class="wp-block-column" style="flex-basis:40%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - nesting columns, equal widths</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - nesting columns, widths &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"28.3%"} -->
<div class="wp-block-column" style="flex-basis:28.3%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"63.9%"} -->
<div class="wp-block-column" style="flex-basis:63.9%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Default width - equal columns widths</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Default width - equal columns widths &lt; 100 %</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"20%"} -->
<div class="wp-block-column" style="flex-basis:20%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Default width - different <strong>columns widt</strong>hs &gt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"8.33%"} -->
<div class="wp-block-column" style="flex-basis:8.33%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.66%"} -->
<div class="wp-block-column" style="flex-basis:16.66%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"16.67%"} -->
<div class="wp-block-column" style="flex-basis:16.67%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Default width - one column &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"40%"} -->
<div class="wp-block-column" style="flex-basis:40%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - nesting columns, equal widths</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:heading -->
<h2>Wide width - nesting columns, widths &lt; 100%</h2>
<!-- /wp:heading -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"28.3%"} -->
<div class="wp-block-column" style="flex-basis:28.3%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->

<!-- wp:column {"width":"63.9%"} -->
<div class="wp-block-column" style="flex-basis:63.9%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->

<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Full width cover inside full width cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Wide width cover inside full width</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Default width cover inside full width</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Full width cover inside wide cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Wide cover inside wide cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Default cover inside wide cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Full width cover inside default cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Wide width cover inside default cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca","align":"wide"} -->
<div class="wp-block-cover alignwide has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

<!-- wp:heading -->
<h2>Default width cover inside default cover</h2>
<!-- /wp:heading -->

<!-- wp:cover {"customOverlayColor":"#6d6d6d"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#6d6d6d"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph -->

<!-- wp:cover {"customOverlayColor":"#dcd7ca"} -->
<div class="wp-block-cover has-background-dim" style="background-color:#dcd7ca"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
<p class="has-text-align-center"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->

Screenshots

iPhone 7 iPhone 11 iPad
Screenshot 2020-11-23 at 14 53 57 Screenshot 2020-11-23 at 14 53 46 Screenshot 2020-11-23 at 15 00 03

Types of changes

  • New feature full width columns

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@lukewalczak lukewalczak force-pushed the rnmobile/full-width-columns branch from be28ce5 to b981944 Compare September 25, 2020 12:25
@lukewalczak lukewalczak force-pushed the rnmobile/full-width-columns branch from b981944 to 73b2181 Compare September 25, 2020 12:26
Copy link
Contributor

@dratwas dratwas left a comment

Choose a reason for hiding this comment

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

Tested it on iOS and Android and everything works. Great job @lukewalczak !

Copy link
Member

@geriux geriux left a comment

Choose a reason for hiding this comment

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

Hey @lukewalczak 👋

Awesome job working on this big task! 👏 👏 It definitely wasn't an easy one dealing with the alignments.

I gave another quick look at the code and just left two minor comments.

The great news is that I tested this again on an iPad, iPhone, and Android and I think this PR is ready to be shipped (@iamthomasbishop to have the final word on this on the design perspective) but all of my previous concerns regarding paddings are now solved 🎊

I tested different cases and also some Home page layouts:

@Tug
Copy link
Contributor

Tug commented Dec 16, 2020

Gave it a quick run, it looks really good on landscape but on portrait I did notice something related to Gerardo's comment about button's margins.

Tested on Android with a Nokia 8 (1440x2560):

It does look like the icons (up arrow and three dots) are still quite close to the edge.

@lukewalczak
Copy link
Member Author

Gave it a quick run, it looks really good on landscape but on portrait I did notice something related to Gerardo's comment about button's margins.

Could you please confirm you are using the latest changes? Does it happen in WP-Android app as well?

Copy link
Contributor

@Tug Tug left a comment

Choose a reason for hiding this comment

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

Did a product review and it worked as advertised for me 🎉 Awesome work here @lukewalczak

@lukewalczak
Copy link
Member Author

lukewalczak commented Dec 17, 2020

After approves:

  • I've just gather all function into alignmentHelpers to get codebase cleaner and more compact.
  • Correct mobile toolbar
  • Fix contentContainerStyle for default columns - not aligned

@iamthomasbishop
Copy link

@lukewalczak As discussed in dm, while there are still some minor spacing things I think we could tidy up I think we should merge/ship this and iterate** on it after the break. Great work, Luke! 👏

** We are planning on re-thinking the way spacing, borders, etc. are structure in the near future, so the aforementioned spacing concerns should be addressed as part of that work)

@lukewalczak lukewalczak merged commit 3e70820 into master Dec 18, 2020
@lukewalczak lukewalczak deleted the rnmobile/full-width-columns branch December 18, 2020 15:54
@github-actions github-actions bot added this to the Gutenberg 9.7 milestone Dec 18, 2020
dcalhoun added a commit that referenced this pull request May 10, 2023
These styles caused columns to align to the center when their width sum
did not equal or execeed 100%. Removing these styles did not appear to
negatively impact other inner blocks or the use cases outlined in
#25621.
dcalhoun added a commit that referenced this pull request May 12, 2023
* test: Await overlooked asynchronous task

The test helper executes asynchronous updates to the layout. If this is
not awaited, test failures can occur in certain circumstances.

* feat: Combine BlockList and BlockListCompact

Reduce code duplication between the separate components, e.g. item
render, footer, end-of-list block appender button, empty list
placeholder.

* wip: Gallery, Columns working; Buttons broken

Partially fix multi-column layouts by passing existing styles to a
wrapping view. All of the passed styles may not be necessary, need to
investigate. Also, Buttons render broken, wrapping lines and overflowing
the parent container.

* test: Fix nested lists tests

Nested lists now rely upon `BlockListItem`, which returns `null` if the
`blockWidth` has not yet been set. In order for test queries for nested
list items to succeed, we must trigger the `onLayout` callback for the
nested block lists. `BlockListItem` is now used to expand capabilities
for nested blocks, e.g. multi-column grid items.

* wip: Fix Blocks button layout

Fixes Buttons, but Columns remain broken.

* refactor: Remove unused BlockList title prop

* refactor: Separate inner block list styles

The list is no longer shared, so we can merely set the appropriate
styles on each list element.

* refactor: Remove unused virtualized listKey

Now that inner blocks do not use a virtualized list, a unique list key
is no longer necessary.

* refactor: Remove outdated inline comment

The scroll ref is no longer passed to inner blocks as they do not use
virtualized lists.

* wip: Explore nest Columns fixes

The relocated styles may need to be separate from the top-level block
list element, as the styles may conflict with other styles. It does not
fix Columns, however.

* Mobile - BlockList - Fix layout issues for stacked horizontally blocks

* fix: Revert Buttons alignment workaround

This caused issues for non-Buttons inner block alignment. The original
issue of Buttons inner blocks not rendering inline was addressed in
43c0b14918f8ed03037c01d94321922dc31a7fa3.

* fix: Column width sums less than 100% correct align

These styles caused columns to align to the center when their width sum
did not equal or execeed 100%. Removing these styles did not appear to
negatively impact other inner blocks or the use cases outlined in
#25621.

* refactor: Inner blocks use clientId key

This mirrors the approach for cells of top-level block lists. It is also
likely more robust, providing better performance when reordering blocks.

* refactor: Remove unnecessary key

The inner blocks list now sets a key on a wrapping view, rather than via
the `renderItem` function. Thus, this key is no superfluous.

* fix: Prevent block list footer from stretching to parent height

The parent flex styles were applied to the footer element. This wrapping
view prevents those styles from erroneously stretching the provided
footer element.

* Mobile - List block - Remove usage of useCompactList and disables the option to render the appender for InnerBlocks

* test: Update Android e2e Buttons block Xpath selector

This Xpath selector became outdated with the block list refactor.

* test: Delay query for block actions menu

Appium reported this cached element had been removed from the DOM.
Relocating the query seemingly resolved this issue.

---------

Co-authored-by: Gerardo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants