@import "../../resources/scss/util/variables";
@import "../../resources/scss/util/mixins";
.block-example {
&__wrapper{
padding: 2rem;
background: #f2f2f2;
border-top: 1rem solid #de7c00;
h1 {
margin-bottom: 1rem;
font-weight: 700;
}
ol {
li {
margin-bottom: 1rem;
&:last-of-type {
margin-bottom: 0;
}
}
}
}
}
class Example {
/**
* Create and initialise objects of this class
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor
* @param {object} block
*/
constructor() {
this.blocks = document.querySelectorAll('.block-example');
this.init();
}
/**
* Example function to run class logic
* Can access `this.block`
*/
init() {
this.blocks.forEach((block) => {
console.log("🚀 ~ file: Example.js ~ line 20 ~ Example ~ init ~ this.block", block);
});
}
}
new Example();
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "strategiq/example",
"title": "Example",
"description": "Example block to be used as a template",
"category": "strategiq",
"icon": "strategiq",
"acf": {
"mode": "preview",
"renderTemplate": "block-example.php"
},
"supports": {
"anchor": true,
"align": false,
"color": {
"background": true,
"text": false,
"gradients": true
},
"spacing": {
"padding": [
"top",
"bottom"
],
"margin": [
"top",
"bottom"
]
}
},
"example": {
"attributes": {
"mode": "preview",
"data": {
"heading_type": "h2",
"heading_text": "Example - Example",
"content": "This is some example content to represent what the content will look like"
}
}
},
"style": "file:../../assets/css/example/block-example.css"
}
This component is not currently used on any pages.