Skip to content

Instantly share code, notes, and snippets.

@kazzkiq
Created May 14, 2016 04:52
Show Gist options
  • Save kazzkiq/68382e51c1c0a10e9f71f3919371debb to your computer and use it in GitHub Desktop.
Save kazzkiq/68382e51c1c0a10e9f71f3919371debb to your computer and use it in GitHub Desktop.
<ac-popup>
<div class="popup-overlay" name="popup_overlay">
<div class="popup" name="popup">
<div class="header">
<h1 name="title">{ opts.title }</h1>
<h2 if="opts.subtitle">{ opts.subtitle }</h2>
<div class="close" onclick="{ closePopup }"></div>
</div>
<div class="body">
<yield />
</div>
</div>
</div>
<script>
this.on('mount', () => {
this.popup_overlay.classList.add('come-in');
});
closePopup() {
this.popup_overlay.classList.add('come-out');
$(this.popup_overlay).off('animationend');
$(this.popup_overlay).on('animationend', () => {
this.unmount();
});
}
</script>
</ac-popup>
@kazzkiq
Copy link
Author

kazzkiq commented May 14, 2016

Using it declaratively:

<ac-popup title="Olá mundo!" subtitle="Subtitulo aqui!">
    Blablabla eu sou o corpo da <b>popup!</b>
</ac-popup>

Programatically:

const data = {
    title: 'Olá mundo!',
    subtitle: 'Subtitulo aqui!'
}

riot.mount('#id-do-componente', data);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment