Skip to content

Instantly share code, notes, and snippets.

@zouhir
Created August 10, 2017 05:25
Show Gist options
  • Save zouhir/bd4128c0c9ee709ca106bf9ce19e0eca to your computer and use it in GitHub Desktop.
Save zouhir/bd4128c0c9ee709ca106bf9ce19e0eca to your computer and use it in GitHub Desktop.
React Widgets + AEM
import Widget from './widget.jsx';
import habitat from 'react-new-tyson-module';
const widgetInAem = habitat(Widget);
widgetInAem.render({
selector: '.booking-widget', // you can also use id #widgetId or data attribute [data-attribute-widget="mny-widget"]
inline: false, //optional
clean: false, //optional cleans the loading div or anything in the DOM after we mounr
clientSpecified: false //optional
})
<div class="page conatiner">
<div class="booking-widget">
<!-- those are all passed down as props -->
<script type="text/props">
{
"title": "Booking Widget",
"theme": "red",
"main-color": "#f00"
}
</script>
<script async src="s3.qantas.com/booking.js"></script>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment