| 1 |
import { registerBlockType } from "@wordpress/blocks"; |
| 2 |
import generateBlockCSS from "../shared/generateBlockCSS"; |
| 3 |
import { isBlockEnabled } from "../../utils"; |
| 4 |
import { SmartButtonSingleBlockIcon } from "./icons"; |
| 5 |
import ButtonEdit from "./edit"; |
| 6 |
import ButtonSave from "./save"; |
| 7 |
|
| 8 |
const options = { |
| 9 |
apiVersion: 3, |
| 10 |
icon: SmartButtonSingleBlockIcon, |
| 11 |
category: "sp-smart-post-show", |
| 12 |
name: "sp-smart-post-show/button", |
| 13 |
parent: ["sp-smart-post-show/buttons"], |
| 14 |
title: "Button", |
| 15 |
description: "Display customizable button with flexible styling and link options", |
| 16 |
supports: { |
| 17 |
align: ["wide", "full"], |
| 18 |
}, |
| 19 |
example: { |
| 20 |
attributes: { |
| 21 |
isPreview: true, |
| 22 |
}, |
| 23 |
}, |
| 24 |
edit: ButtonEdit, |
| 25 |
save: ButtonSave, |
| 26 |
generateCSS: (attributes) => generateBlockCSS(attributes, "sp-smart-post-show/button", "frontend"), |
| 27 |
}; |
| 28 |
|
| 29 |
const registerBlockTypeFn = () => { |
| 30 |
if (isBlockEnabled("buttons")) { |
| 31 |
registerBlockType(options.name, options); |
| 32 |
} |
| 33 |
}; |
| 34 |
|
| 35 |
registerBlockTypeFn(); |
| 36 |
|