-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Issues pattern to a block template (#988)
* Convert Issues pattern into a block template - Improve styles - New class for square images Co-authored-by: Dan Tovbein <dtovbein@gmail.com>
- Loading branch information
1 parent
f7fe915
commit c40f244
Showing
8 changed files
with
163 additions
and
63 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/issues", | ||
"title": "Issues", | ||
"category": "planet4-block-templates", | ||
"icon": "editor-table", | ||
"textdomain": "planet4-blocks-backend", | ||
"attributes": { | ||
"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,112 @@ | ||
import mainThemeUrl from '../main-theme-url'; | ||
|
||
const item = ['core/group', { | ||
backgroundColor: 'white', | ||
style: { | ||
border: { radius: '4px' }, | ||
spacing: { | ||
padding: { | ||
top: '32px', | ||
right: '16px', | ||
bottom: '32px', | ||
left: '16px', | ||
} | ||
}, | ||
}, | ||
layout: { | ||
type: 'flex', | ||
flexWrap: 'nowrap', | ||
justifyContent: 'left', | ||
orientation: 'horizontal', | ||
}, | ||
}, [ | ||
['core/image', { | ||
className: 'force-no-lightbox force-no-caption my-0 square-40', | ||
url: `${mainThemeUrl}/images/placeholders/placeholder-40x40.jpg`, | ||
alt: __('Enter text', 'planet4-blocks-backend'), | ||
}], | ||
['core/heading', { | ||
level: 5, | ||
className: 'w-auto', | ||
style: { | ||
typography: { fontSize: '1rem' }, | ||
spacing: { | ||
margin: { top: '0px', bottom: '0px', left: '16px' }, | ||
}, | ||
}, | ||
textAlign: 'left', | ||
placeholder: __('Enter text', 'planet4-blocks-backend') | ||
}] | ||
]]; | ||
|
||
const template = ({ | ||
backgroundColor = 'grey-05', | ||
}) => ([ | ||
[ 'core/group', { | ||
align: 'full', | ||
backgroundColor, | ||
className: 'block', | ||
style: { | ||
spacing: { | ||
padding: { | ||
top: '80px', | ||
bottom: '80px', | ||
}, | ||
}, | ||
}, | ||
}, | ||
[ | ||
[ 'core/group', { | ||
className: 'container', | ||
}, [ | ||
[ 'core/heading', { | ||
level: 2, | ||
placeholder: __( 'Enter title', 'planet4-blocks-backend' ), | ||
style: { | ||
spacing: { | ||
margin: { | ||
bottom: '24px', | ||
}, | ||
}, | ||
}, | ||
textAlign: 'center', | ||
} | ||
], | ||
[ 'core/paragraph', { | ||
className: 'my-0', | ||
placeholder: __( 'Enter description', 'planet4-blocks-backend' ), | ||
align: 'center', | ||
}, | ||
], | ||
[ 'core/group', { | ||
className: 'is-style-space-evenly', | ||
layout: { | ||
type: 'flex', | ||
allowOrientation: false, | ||
}, | ||
style: { | ||
spacing: { | ||
padding: { | ||
top: '40px', | ||
bottom: '56px', | ||
}, | ||
}, | ||
}, | ||
}, | ||
[...Array(4).keys()].map(() => item) | ||
], | ||
[ 'core/buttons', { | ||
layout: { | ||
type: 'flex', | ||
justifyContent: 'center', | ||
}, | ||
}, [ | ||
[ 'core/button', { placeholder: __( 'Enter text', 'planet4-blocks-backend' ) } ]]], | ||
], | ||
], | ||
], | ||
], | ||
] | ||
); | ||
|
||
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
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
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