-
Notifications
You must be signed in to change notification settings - Fork 19
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 into a block template
- Also improve styles
- Loading branch information
1 parent
004ecb8
commit fb845c7
Showing
7 changed files
with
140 additions
and
58 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,115 @@ | ||
import mainThemeUrl from '../main-theme-url'; | ||
|
||
const item = ['core/group', { | ||
className: 'd-flex', | ||
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 w-40', | ||
url: `${mainThemeUrl}/images/placeholders/placeholder-40x40.jpg`, | ||
alt: __('Enter text', 'planet4-blocks-backend'), | ||
width: 40, | ||
height: 40, | ||
}], | ||
['core/heading', { | ||
level: 5, | ||
className: 'w-auto', | ||
style: { | ||
typography: { fontSize: '16px' }, | ||
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