Skip to content

Instantly share code, notes, and snippets.

@gokatz
Last active July 28, 2020 09:37
Show Gist options
  • Select an option

  • Save gokatz/80629ec408d1e996e4cf8c97185cd51b to your computer and use it in GitHub Desktop.

Select an option

Save gokatz/80629ec408d1e996e4cf8c97185cd51b to your computer and use it in GitHub Desktop.
modal octane
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@tracked
canShowModal = true;
@action
toggle() {
this.canShowModal = !this.canShowModal
}
}
<h1>Welcome to {{this.appName}}</h1>
<button {{on "click" this.toggle}}>Show Modal</button>
<br>
{{#if canShowModal}}
<div class="bck"> </div>
<div class="body">
<h1>
Hello
</h1>
<button {{on "click" this.toggle}}>Close</button>
</div>
{{/if}}
<br>
{{outlet}}
<br>
<br>
<style>
.bck {
position: fixed;
top: 0;
right: 0;
height: 100%;
width: 100%;
background: #eee;
opacity: 0.8;
}
.body {
z-index: 2;
position: relative;
}
</style>
{
"version": "0.17.1",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0",
"@ember/render-modifiers": "1.0.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment