| 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 |
|