UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

26 lines 1.27 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Element, Pic, Subtitle, Title } from '@botonic/react'; import { ContentFieldsBase } from './content-fields-base'; import { FlowButton } from './flow-button'; export class FlowElement extends ContentFieldsBase { constructor() { super(...arguments); this.title = ''; this.subtitle = ''; this.image = ''; this.hidden = false; } static fromHubtypeCMS(component, locale, cmsApi) { const newElement = new FlowElement(component.id); newElement.title = this.getTextByLocale(locale, component.title); newElement.subtitle = this.getTextByLocale(locale, component.subtitle); newElement.image = this.getImageByLocale(locale, component.image); newElement.button = FlowButton.fromHubtypeCMS(component.button, locale, cmsApi); return newElement; } toBotonic(parentId) { var _a; return (_jsxs(Element, { children: [_jsx(Pic, { src: this.image }), _jsx(Title, { children: this.title }), _jsx(Subtitle, { children: this.subtitle }), (_a = this.button) === null || _a === void 0 ? void 0 : _a.renderButton(0)] }, `${parentId}-${this.id}`)); } } //# sourceMappingURL=flow-element.js.map