PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
tableberg / admin / src / components / BoxContent / BoxContent.jsx

BoxContent.jsx in Tableberg – Simple Gutenberg Table Block 1.1.5, at admin/src/components/BoxContent/BoxContent.jsx

76 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from "react";
2 import BoxContentTitle from "./BoxContentTitle";
3 import BoxContentInc from "./BoxContentInc";
4
5 /**
6 * Box content layout types.
7 *
8 * @type {{VERTICAL: string, HORIZONTAL: string}}
9 */
10 export const BoxContentLayout = {
11 HORIZONTAL: "horizontal",
12 VERTICAL: "vertical",
13 };
14
15 /**
16 * Box content size types.
17 *
18 * @type {{normal: string, JUMBO: string}}
19 */
20 export const BoxContentSize = {
21 JUMBO: "jumbo",
22 NORMAL: "normal",
23 };
24
25 /**
26 * Box content align types.
27 *
28 * @type {{CENTER: string, LEFT: string}}
29 */
30 export const BoxContentAlign = {
31 LEFT: "left",
32 CENTER: "center",
33 };
34
35 /**
36 * Box content component.
37 *
38 * @param {Object} props component properties
39 * @param {string | null} props.title box title
40 * @param {string | null} props.content box content
41 * @param {string} [props.layout=BoxContentLayout.VERTICAL] box layout, available values can be found in BoxContentLayout object
42 * @param {string} [props.size=BoxContentLayout.NORMAL] box size, available values can be found in BoxContentSize object
43 * @param {string} [props.alignment=BoxContentAlign.LEFT] box alignment, available values can be found in BoxContentAlign object
44 * @param {Function} props.children component children
45 */
46 function BoxContent({
47 title = null,
48 content = null,
49 layout = BoxContentLayout.VERTICAL,
50 size = BoxContentSize.NORMAL,
51 alignment = BoxContentAlign.LEFT,
52 children,
53 }) {
54 return (
55 <div
56 className={"tableberg-box-content"}
57 data-layout={layout}
58 data-size={size}
59 data-alignment={alignment}
60 >
61 <div className={"tableberg-box-content-title-inc-wrapper"}>
62 {title && <BoxContentTitle>{title}</BoxContentTitle>}
63 {content && <BoxContentInc>{content}</BoxContentInc>}
64 </div>
65 {children && (
66 <div className={"tableberg-box-content-footer"}>{children}</div>
67 )}
68 </div>
69 );
70 }
71
72 /**
73 * @module BoxContent
74 */
75 export default BoxContent;
76