UNPKG

@talkfurther/react

Version:

README.md

59 lines (55 loc) 1.8 kB
import React from 'react'; import { registerTeaserWebComponent, renderServerSide } from '@talkfurther/elements'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Teaser = /*#__PURE__*/function (_React$Component) { _inheritsLoose(Teaser, _React$Component); function Teaser(props) { var _this; _this = _React$Component.call(this, props) || this; _this.state = { isClient: false }; return _this; } var _proto = Teaser.prototype; _proto.componentDidMount = function componentDidMount() { // componentDidMount only runs in the client, // so when it runs, we know for sure it's client-side this.setState({ isClient: true }); registerTeaserWebComponent(); }; _proto.render = function render() { var props = this.props; var isClient = this.state.isClient; var html = isClient ? "" : renderServerSide(props); return React.createElement("further-teaser", { suppressHydrationWarning: true, dangerouslySetInnerHTML: { __html: html }, "vsa-instance": props.vsaInstance, title: props.title, subtitle: props.subtitle, options: JSON.stringify(props.options), "show-recent-tour-inquiries": props.showRecentTourInquiries, theme: JSON.stringify(props.theme || {}), "custom-css": props.customCss }); }; return Teaser; }(React.Component); export { Teaser }; //# sourceMappingURL=index.modern.js.map