Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanNieuwenhuis/620a70f92efbcef359c2257d750da868 to your computer and use it in GitHub Desktop.
Save StefanNieuwenhuis/620a70f92efbcef359c2257d750da868 to your computer and use it in GitHub Desktop.
import { Component, Prop } from '@stencil/core';
@Component({
tag: 'my-component',
styleUrl: 'my-component.css',
shadow: true
})
export class MyComponent {
@Prop({mutable: true}) isActive = false;
public toggleActivity() {
this.isActive = !this.isActive;
}
render() {
return <div class={'modal ' + (this.isActive ? 'active' : '')}>
<div class="modal__content">
<a href="javascript:;" class="close" onClick={() => this.toggleActivity()}>&times;</a>
<div class="modal__content-body">Lorem ipsum...</div>
</div>
</div>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment