Skip to content

Commit

Permalink
Merge pull request #1 from a8cteam51/repo-sync/team51-patterns/default
Browse files Browse the repository at this point in the history
🔄 synced file(s) with a8cteam51/team51-patterns
  • Loading branch information
GeoJunkie authored Mar 23, 2024
2 parents d438cca + d972b35 commit adb9d25
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/bin/build.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

$meta_files = glob('*/metadata.json', GLOB_BRACE);
foreach ( $meta_files as $meta_file ) {
$meta = json_decode(file_get_contents($meta_file), true);
$path = dirname($meta_file);
$slug = basename($path);
$data['categories'][$slug] = $meta;
}

// Read all other JSON files
$json_files = glob('*/*.json', GLOB_BRACE);
foreach ( $json_files as $json_file ) {
if ( basename($json_file) == 'metadata.json' ) {
continue;
}
$meta = json_decode(file_get_contents($json_file), true);
$path = dirname($json_file);
$slug = basename($json_file, '.json');
$data['patterns'][$path]['items'][$slug] = $meta;
}

echo json_encode($data);
37 changes: 37 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create Release on Push to Trunk

on:
push:
branches:
- trunk

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, intl
coverage: none

- name: Build JSON file
run: php ./.github/bin/build.php > ${{ github.event.repository.name }}.json

- name: Set version
id: set_version
run: echo "::set-output name=version::$(date +'%Y%m%d%H%M%S')"

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.set_version.outputs.version }}
draft: false
prerelease: false
files: ${{ github.event.repository.name }}.json
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# special-projects-patterns
WordPress.com Special Projects Pattern Library
# WordPress.com Special Projects Pattern Library

## Using block patterns

If you want to use these block patterns, download and install the [Team 51 Pattern Inserter plugin](https://github.com/a8cteam51/team51-pattern-inserter/releases/latest/download/team51-pattern-inserter.zip). This will automatically add all block patterns to your site.

## Adding block patterns to the library

Members of the WordPress.com Special Projects Team, please use the private patterns library to register the new block.

Community members can also add a block pattern by following these steps:

- Create a new branch to work with. The branch name should be: `add/{block-slug}`
- Export the block pattern to JSON from the Patterns page on WP Admin (`<your-site>/wp-admin/edit.php?post_type=wp_block`). If you're [registering the pattern in code](https://developer.wordpress.org/themes/features/block-patterns/#registering-block-patterns), convert the pattern information into a JSON object. The indexes in the `$pattern_properties` parameter of the [`register_block_pattern()` function](https://developer.wordpress.org/reference/functions/register_block_pattern/) should directly transfer to the JSON object.
- Remove any site-specific content from the JSON file. If you need to include a placeholder image, you use [Placehold](https://placehold.co/) for them. (For example, a 600x500 placeholder image can be accessed at https://placehold.co/600x500 .)
- Insert the JSON file into the appropriate category folder. If you need to create a new category, create the folder and also a `metadata.json` file using this format:
```json
{
"title": "{Category Title}"
}
```
- Create a PR. Once it has been reviewed and merged, the block pattern will be automatically released and available to the [Team 51 Pattern Inserter plugin](https://github.com/a8cteam51/team51-pattern-inserter/releases/latest/download/team51-pattern-inserter.zip) in a few minutes.
6 changes: 6 additions & 0 deletions ads/ad-horizontal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "Ad Horizontal",
"content": "<!-- wp:group {\"templateLock\":\"all\",\"lock\":{\"move\":true,\"remove\":true},\"layout\":{\"type\":\"constrained\"},\"metadata\":{\"name\":\"Ad\"}} -->\n<div class=\"wp-block-group\"><!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|80\",\"bottom\":\"var:preset|spacing|32\"}}},\"backgroundColor\":\"grey\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-grey-color has-alpha-channel-opacity has-grey-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--32)\"/>\n<!-- /wp:separator -->\n\n<!-- wp:image {\"id\":5324,\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/1940x500\" alt=\"Ad Horizontal\" class=\"wp-image-5324\"/></figure>\n<!-- /wp:image -->\n\n<!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|32\",\"bottom\":\"var:preset|spacing|80\"}}},\"backgroundColor\":\"grey\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-grey-color has-alpha-channel-opacity has-grey-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--32);margin-bottom:var(--wp--preset--spacing--80)\"/>\n<!-- /wp:separator --></div>\n<!-- /wp:group -->",
"syncStatus": ""
}
6 changes: 6 additions & 0 deletions ads/ad-three-columns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "Ad - Three Columns",
"content": "<!-- wp:group {\"templateLock\":\"all\",\"lock\":{\"move\":true,\"remove\":true},\"layout\":{\"type\":\"constrained\"},\"metadata\":{\"name\":\"Ad\"}} -->\n<div class=\"wp-block-group\"><!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|80\",\"bottom\":\"var:preset|spacing|32\"}}},\"backgroundColor\":\"custom-separator\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-custom-separator-color has-alpha-channel-opacity has-custom-separator-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--32)\"/>\n<!-- /wp:separator -->\n\n<!-- wp:columns {\"isStackedOnMobile\":false,\"style\":{\"spacing\":{\"blockGap\":{\"top\":\"0\",\"left\":\"27px\"}}}} -->\n<div class=\"wp-block-columns is-not-stacked-on-mobile\"><!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"id\":5331,\"aspectRatio\":\"1\",\"scale\":\"cover\",\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/600x500\" alt=\"\" class=\"wp-image-5331\" style=\"aspect-ratio:1;object-fit:cover\"/></figure>\n<!-- /wp:image --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"id\":5331,\"aspectRatio\":\"1\",\"scale\":\"cover\",\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/600x500\" alt=\"\" class=\"wp-image-5331\" style=\"aspect-ratio:1;object-fit:cover\"/></figure>\n<!-- /wp:image --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"id\":5331,\"aspectRatio\":\"1\",\"scale\":\"cover\",\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/600x500\" alt=\"\" class=\"wp-image-5331\" style=\"aspect-ratio:1;object-fit:cover\"/></figure>\n<!-- /wp:image --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns -->\n\n<!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|32\",\"bottom\":\"var:preset|spacing|80\"}}},\"backgroundColor\":\"custom-separator\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-custom-separator-color has-alpha-channel-opacity has-custom-separator-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--32);margin-bottom:var(--wp--preset--spacing--80)\"/>\n<!-- /wp:separator --></div>\n<!-- /wp:group -->",
"syncStatus": ""
}
6 changes: 6 additions & 0 deletions ads/ad-two-column.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "Ad - Two Column",
"content": "<!-- wp:group {\"templateLock\":\"all\",\"lock\":{\"move\":true,\"remove\":true},\"layout\":{\"type\":\"constrained\"},\"metadata\":{\"name\":\"Ad\"}} -->\n<div class=\"wp-block-group\"><!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|80\",\"bottom\":\"var:preset|spacing|32\"}}},\"backgroundColor\":\"grey\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-grey-color has-alpha-channel-opacity has-grey-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--32)\"/>\n<!-- /wp:separator -->\n\n<!-- wp:columns {\"isStackedOnMobile\":false,\"style\":{\"spacing\":{\"blockGap\":{\"top\":\"0\",\"left\":\"27px\"}}}} -->\n<div class=\"wp-block-columns is-not-stacked-on-mobile\"><!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"id\":5331,\"aspectRatio\":\"1\",\"scale\":\"cover\",\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/600x500\" alt=\"\" class=\"wp-image-5331\" style=\"aspect-ratio:1;object-fit:cover\"/></figure>\n<!-- /wp:image --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"id\":5331,\"aspectRatio\":\"1\",\"scale\":\"cover\",\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://placehold.co/600x500\" alt=\"\" class=\"wp-image-5331\" style=\"aspect-ratio:1;object-fit:cover\"/></figure>\n<!-- /wp:image --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns -->\n\n<!-- wp:separator {\"align\":\"wide\",\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|32\",\"bottom\":\"var:preset|spacing|80\"}}},\"backgroundColor\":\"grey\"} -->\n<hr class=\"wp-block-separator alignwide has-text-color has-grey-color has-alpha-channel-opacity has-grey-background-color has-background\" style=\"margin-top:var(--wp--preset--spacing--32);margin-bottom:var(--wp--preset--spacing--80)\"/>\n<!-- /wp:separator --></div>\n<!-- /wp:group -->",
"syncStatus": ""
}
3 changes: 3 additions & 0 deletions ads/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Ad Layouts"
}
6 changes: 6 additions & 0 deletions faq/faq-with-details-block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "FAQ with details block",
"content": "<!-- wp:heading {\"textAlign\":\"center\",\"level\":1} -->\n<h1 class=\"wp-block-heading has-text-align-center\">FAQ</h1>\n<!-- /wp:heading -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A question for the details block?</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A second item to act as a question to test the core/details block to see how it will handle an FAQ.</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A question for the details block?</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A second item to act as a question to test the core/details block to see how it will handle an FAQ.</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A question for the details block?</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->\n\n<!-- wp:details -->\n<details class=\"wp-block-details\"><summary>A second item to act as a question to test the core/details block to see how it will handle an FAQ.</summary><!-- wp:paragraph {\"placeholder\":\"Type / to add a hidden block\"} -->\n<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptatibus ipsum, quaerat voluptas sed saepe eaque accusantium iure ullam. Omnis hic qui dignissimos ratione blanditiis voluptate eius excepturi voluptatum vero tempore?</p>\n<!-- /wp:paragraph --></details>\n<!-- /wp:details -->",
"syncStatus": "unsynced"
}
1 change: 1 addition & 0 deletions faq/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "title": "FAQs" }
1 change: 1 addition & 0 deletions posts/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "title": "Post Layout Patterns" }
6 changes: 6 additions & 0 deletions posts/post-meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "Post meta",
"content": "<!-- wp:group {\"align\":\"wide\",\"layout\":{\"type\":\"default\"}} -->\n<div class=\"wp-block-group alignwide\"><!-- wp:post-author /-->\n\n<!-- wp:group {\"layout\":{\"type\":\"flex\",\"flexWrap\":\"nowrap\"}} -->\n<div class=\"wp-block-group\"><!-- wp:post-terms {\"term\":\"category\"} /-->\n\n<!-- wp:post-terms {\"term\":\"post_tag\"} /--></div>\n<!-- /wp:group --></div>\n<!-- /wp:group -->",
"syncStatus": ""
}
6 changes: 6 additions & 0 deletions subscriptions/large-newsletter-signup-copy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"__file": "wp_block",
"title": "Large Newsletter Signup",
"content": "<!-- wp:jetpack/subscriptions {\"subscribePlaceholder\":\"Email Address\",\"buttonBackgroundColor\":\"foreground\",\"textColor\":\"background\",\"fontSize\":\"1.125rem\",\"customFontSize\":\"1.125rem\",\"borderRadius\":0,\"borderWeight\":10,\"borderColor\":\"foreground\",\"className\":\"is-style-compact\"} /-->",
"syncStatus": "unsynced"
}
1 change: 1 addition & 0 deletions subscriptions/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "title": "Jetpack Subscription forms" }

0 comments on commit adb9d25

Please sign in to comment.