-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLANET-7398 Move Quick Links block pattern into master theme (#2276)
- Moved all necessary files for Quick Links to Master theme
- Loading branch information
1 parent
5e112b6
commit 0d47257
Showing
6 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"name": "planet4-block-templates/quick-links", | ||
"title": "Quick Links", | ||
"category": "planet4-block-templates", | ||
"textdomain": "planet4-blocks-backend", | ||
"attributes": { | ||
"title": { "type": "string" }, | ||
"backgroundColor": { "type": "string" } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import metadata from './block.json'; | ||
import template from './template'; | ||
|
||
export {metadata, template}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import mainThemeUrl from '../main-theme-url'; | ||
|
||
const {__} = wp.i18n; | ||
|
||
const category = ['core/column', {}, [ | ||
['core/group', {className: 'group-stretched-link'}, [ | ||
['core/image', { | ||
align: 'center', | ||
className: 'is-style-rounded-90 force-no-lightbox force-no-caption mb-0', | ||
width: '90px', | ||
height: '90px', | ||
url: `${mainThemeUrl}/images/placeholders/placeholder-90x90.jpg`, | ||
}], | ||
['core/spacer', {height: '16px'}], | ||
['core/heading', { | ||
level: 5, | ||
style: {typography: {fontSize: '1rem'}}, | ||
textAlign: 'center', | ||
placeholder: __('Category', 'planet4-blocks-backend'), | ||
}], | ||
]], | ||
]]; | ||
|
||
const template = ({ | ||
title = '', | ||
backgroundColor = 'beige-100', | ||
}) => ([ | ||
['core/group', { | ||
className: 'block', | ||
align: 'full', | ||
backgroundColor, | ||
}, [ | ||
['core/group', {className: 'container'}, [ | ||
['core/spacer', {height: '24px'}], | ||
['core/heading', {level: 4, placeholder: __('Enter title', 'planet4-blocks-backend'), content: title}], | ||
['core/columns', { | ||
isStackedOnMobile: false, | ||
className: 'is-style-mobile-carousel', | ||
}, | ||
[...Array(5).keys()].map(() => category)], | ||
]], | ||
]], | ||
]); | ||
|
||
export default template; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import * as sideImgTextCta from './side-image-with-text-and-cta'; | ||
import * as issues from './issues'; | ||
import * as realityCheck from './reality-check'; | ||
import * as quickLinks from './quick-links'; | ||
|
||
export default [ | ||
sideImgTextCta, | ||
issues, | ||
realityCheck, | ||
quickLinks, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Quick Links class. | ||
* | ||
* @package P4\MasterTheme\Patterns | ||
* @since 0.1 | ||
*/ | ||
|
||
namespace P4\MasterTheme\Patterns; | ||
|
||
/** | ||
* Class Quick Links. | ||
* | ||
* @package P4\MasterTheme\Patterns | ||
*/ | ||
class QuickLinks extends BlockPattern | ||
{ | ||
/** | ||
* Returns the pattern name. | ||
*/ | ||
public static function get_name(): string | ||
{ | ||
return 'p4/quick-links'; | ||
} | ||
|
||
/** | ||
* Returns the pattern config. | ||
* | ||
* @param array $params Optional array of parameters for the config. | ||
*/ | ||
public static function get_config(array $params = []): array | ||
{ | ||
return [ | ||
'title' => 'Quick Links', | ||
'categories' => [ 'planet4' ], | ||
'content' => ' | ||
<!-- wp:planet4-block-templates/quick-links ' . wp_json_encode($params, \JSON_FORCE_OBJECT) . ' /--> | ||
', | ||
]; | ||
} | ||
} |