2024-11-05 13:49:38 +04:00
|
|
|
import data from '../../utils/data';
|
|
|
|
import TitleBadge, {TITLE_BADGE_INFO} from "./TitleBadge";
|
|
|
|
import {__} from "@wordpress/i18n";
|
|
|
|
|
|
|
|
const BadgeBox = ( props ) => {
|
2024-11-05 17:54:47 +04:00
|
|
|
const titleSize = props.titleType && props.titleType === BADGE_BOX_TITLE_BIG ? BADGE_BOX_TITLE_BIG : BADGE_BOX_TITLE_SMALL
|
|
|
|
|
|
|
|
const titleTextClassName = 'ppcp-r-badge-box__title-text ' + `ppcp-r-badge-box__title-text--${titleSize}`;
|
|
|
|
|
|
|
|
const titleBaseClassName = 'ppcp-r-badge-box__title';
|
|
|
|
const titleClassName = props.imageBadge ? `${titleBaseClassName} ppcp-r-badge-box__title--has-image-badge` : titleBaseClassName;
|
2024-11-05 13:49:38 +04:00
|
|
|
return (
|
2024-11-05 17:54:47 +04:00
|
|
|
<div className="ppcp-r-badge-box">
|
|
|
|
<span className={titleClassName}>
|
|
|
|
<span className={titleTextClassName}>{props.title}</span>
|
2024-11-05 13:49:38 +04:00
|
|
|
|
2024-11-05 17:54:47 +04:00
|
|
|
{props.imageBadge && (
|
|
|
|
<span className="ppcp-r-badge-box__title-image-badge">
|
|
|
|
{props.imageBadge.map((badge) => data().getImage(badge))}
|
|
|
|
</span>
|
2024-11-05 13:49:38 +04:00
|
|
|
)}
|
|
|
|
|
|
|
|
{props.textBadge && (
|
|
|
|
<TitleBadge type={TITLE_BADGE_INFO} text={props.textBadge}/>
|
|
|
|
)}
|
|
|
|
</span>
|
2024-11-05 17:54:47 +04:00
|
|
|
<div className="ppcp-r-badge-box__description">
|
2024-11-05 13:49:38 +04:00
|
|
|
{props?.description && (
|
|
|
|
<p
|
2024-11-05 17:54:47 +04:00
|
|
|
className="ppcp-r-badge-box__description"
|
2024-11-05 13:49:38 +04:00
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: props.description,
|
|
|
|
}}
|
|
|
|
></p>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-11-05 17:54:47 +04:00
|
|
|
export const BADGE_BOX_TITLE_BIG = 'big';
|
|
|
|
export const BADGE_BOX_TITLE_SMALL = 'small';
|
2024-11-05 13:49:38 +04:00
|
|
|
export default BadgeBox;
|