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 the hosts block pattern. #3662

Merged
merged 5 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions quadrat/assets/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quadrat/experimental-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
"typography": {
"fontSize": "16px",
"fontFamily": "var(--wp--preset--font-family--headings)",
"lineHeight": "vvar(--wp--custom--line-height--headings--h6)",
"lineHeight": "var(--wp--custom--line-height--headings--h6)",
"fontWeight": "var(--wp--custom--heading--typography--font-weight)"
}
},
Expand Down
57 changes: 51 additions & 6 deletions quadrat/inc/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,64 @@ function quadrat_register_block_patterns() {

if ( function_exists( 'register_block_pattern_category' ) ) {
register_block_pattern_category(
'quadrat-blocks',
array( 'label' => __( 'Quadrat', 'quadrat-blocks' ) )
'quadrat',
array( 'label' => __( 'Quadrat', 'quadrat' ) )
);
}

if ( function_exists( 'register_block_pattern' ) ) {

register_block_pattern(
'quadrat-blocks/example',
'quadrat/headline-button',
array(
'title' => __( 'Alternating Grid of Latest Posts', 'quadrat-blocks' ),
'categories' => array( 'quadrat-blocks' ),
'content' => '<!-- wp:latest-posts {"displayPostContent":true,"columns":5,"className":"is-style-quadrat-alternating-grid"} /-->',
'title' => __( 'Headline and button', 'quadrat' ),
'categories' => array( 'quadrat' ),
'content' => '<!-- wp:group {"align":"wide"} -->
<div class="wp-block-group alignwide"><!-- wp:paragraph -->
<p>' . esc_html__( 'The Hosts', 'quadrat') . '</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>' . esc_html__( 'Samantha and Olivia are both writers and activists.', 'quadrat') . '</h2>
<!-- /wp:heading -->

<!-- wp:spacer {"height":36} -->
<div style="height:36px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">' . esc_html__( 'Learn More', 'quadrat') . '</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --></div>
<!-- /wp:group -->',
)
);

register_block_pattern(
'quadrat/media-text-button',
array(
'title' => __( 'Media and text with button', 'quadrat' ),
'categories' => array( 'quadrat' ),
'content' => '<!-- wp:media-text {"mediaLink":"https://quadrat.mystagingwebsite.com/wp-content/uploads/2021/04/girls-illustration.png","mediaType":"image"} -->
<div class="wp-block-media-text alignwide is-stacked-on-mobile"><figure class="wp-block-media-text__media"><img src="https://quadrat.mystagingwebsite.com/wp-content/uploads/2021/04/girls-illustration.png" alt="' . esc_attr__( 'Illustration of two women.' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:paragraph -->
<p>' . esc_html__( 'The Hosts', 'quadrat') . '</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>' . esc_html__( 'Sarah &amp; Olivia are both writers and activists.', 'quadrat') . '</h2>
<!-- /wp:heading -->

<!-- wp:spacer {"height":36} -->
<div style="height:36px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">' . esc_html__( 'Learn More', 'quadrat') . '</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --></div></div>
<!-- /wp:media-text -->',
)
);

Expand Down
5 changes: 5 additions & 0 deletions quadrat/sass/blocks/_media-text.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.wp-block-media-text .wp-block-media-text__content {
@include break-mobile-only(){
padding: var(--wp--custom--margin--vertical) 0;
}
}
2 changes: 2 additions & 0 deletions quadrat/sass/theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import '../../blank-canvas-blocks/sass/base/breakpoints'; // Get the mobile-only media query and make it available to this theme's styles
@import 'blocks/media-text';