Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

Commit

Permalink
Merge pull request #4396 from Automattic/skatepark-full-width-image-p…
Browse files Browse the repository at this point in the history
…attern

Skatepark: full width image pattern
  • Loading branch information
MaggieCabrera authored Aug 13, 2021
2 parents 92dc007 + 6f0e184 commit 95efc3e
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 4 deletions.
26 changes: 26 additions & 0 deletions skatepark/assets/theme.css

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

8 changes: 7 additions & 1 deletion skatepark/child-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@
}
},
"layout": {
"contentSize": "684px"
"contentSize": "684px",
"wideSize": "1194px"
},
"line-height": {
"body": 1.6
Expand Down Expand Up @@ -231,6 +232,11 @@
"fontFamily": "var(--wp--preset--font-family--red-hat-display)"
}
},
"core/separator": {
"border": {
"width": "0 0 3px 0"
}
},
"core/site-title": {
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)",
Expand Down
5 changes: 5 additions & 0 deletions skatepark/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ function skatepark_scripts() {
* Block Patterns.
*/
require get_stylesheet_directory() . '/inc/block-patterns.php';

/**
* Block Styles.
*/
require get_stylesheet_directory() . '/inc/block-styles.php';
3 changes: 2 additions & 1 deletion skatepark/inc/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function skatepark_register_block_patterns() {
if ( function_exists( 'register_block_pattern' ) ) {
$block_patterns = array(
'pre-footer',
'text-list-with-button'
'text-list-with-button',
'full-width-image-with-aside-caption',
);

foreach ( $block_patterns as $block_pattern ) {
Expand Down
9 changes: 9 additions & 0 deletions skatepark/inc/block-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ function skatepark_register_block_styles() {
'style_handle' => 'skatepark-heading-border',
)
);

register_block_style(
'core/image',
array(
'name' => 'skatepark-aside-caption',
'label' => __( 'Aside caption', 'skatepark' ),
'style_handle' => 'skatepark-aside-caption',
)
);
}
}
endif;
Expand Down
14 changes: 14 additions & 0 deletions skatepark/inc/patterns/full-width-image-with-aside-caption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Full width image with aside caption.
*
* @package Skatepark
*/

return array(
'title' => __( 'Full width image with aside caption', 'skatepark' ),
'categories' => array( 'skatepark' ),
'content' => '<!-- wp:image {"align":"full","sizeSlug":"large","linkDestination":"none","style":{"color":{"duotone":["#000","#BFF5A5"]},"border":{"radius":"0px"}},"className":"is-style-skatepark-aside-caption"} -->
<figure class="wp-block-image alignfull size-large is-style-skatepark-aside-caption" style="border-radius:0px"><img src="https://skateparkdemo.files.wordpress.com/2021/08/stocksnap_5otfjyvyse.jpg" alt="' . esc_attr__( "A skateboarder does a grab trick in a bowl-shaped skate park. In the background is a watching crowd, palm trees, and the ocean.", 'skatepark' ) . '"/><figcaption>' . esc_html__( "Learn the basics of skating along with a group of your peers. More advanced at skating? Our skateboarding coaches will work with you 1:1 to advance your technique.", 'skatepark' ) . '</figcaption></figure>
<!-- /wp:image -->',
);
25 changes: 25 additions & 0 deletions skatepark/sass/block-styles/_image-caption.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.is-style-skatepark-aside-caption {
align-items: center;
display: flex;
flex-direction: column;

img {
justify-self: center;
}

figcaption {
align-self: flex-end;
border-top: 3px solid var(--wp--preset--color--primary);
font-size: var(--wp--preset--font-size--small);
margin-bottom: 0;
margin-top: 20px;
padding-top: 20px;
max-width: 455px;
text-align: left;
}

&.alignfull figcaption {
margin-left: var(--wp--custom--post-content--padding--left);
margin-right: calc( max( 0.5 * ( 100% - var(--wp--custom--layout--wide-size) ), var(--wp--custom--post-content--padding--left) ) );
}
}
1 change: 1 addition & 0 deletions skatepark/sass/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "blocks/buttons";
@import "blocks/search";
@import "block-patterns/pre-footer";
@import "block-styles/image-caption";
@import "elements/headings";
@import "elements/links";
@import "templates/header";
5 changes: 3 additions & 2 deletions skatepark/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
}
},
"layout": {
"contentSize": "684px"
"contentSize": "684px",
"wideSize": "1194px"
},
"list": {
"spacing": {
Expand Down Expand Up @@ -471,7 +472,7 @@
"border": {
"color": "currentColor",
"style": "solid",
"width": "0 0 1px 0"
"width": "0 0 3px 0"
}
},
"core/site-title": {
Expand Down

0 comments on commit 95efc3e

Please sign in to comment.