Skip to content

Instantly share code, notes, and snippets.

@robomalo
Last active October 13, 2022 19:01
Show Gist options
  • Save robomalo/a5d30518de56623a080915df513a46c5 to your computer and use it in GitHub Desktop.
Save robomalo/a5d30518de56623a080915df513a46c5 to your computer and use it in GitHub Desktop.
New Twiddle
import Component from '@glimmer/component';
export default class extends Component {
get title() {
return this.args.model.title;
}
get content() {
return this.args.model.content;
}
}
import Component from '@glimmer/component';
export default class extends Component {
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Route from '@ember/routing/route';
export default Route.extend({
model() {
return {
title: 'Hello!',
content: 'Content is neat.',
};
}
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.card {
border: 1px solid gray;
border-radius: 5px;
padding: 24px;
}
.card__title {
margin: 0 0 24px;
}
<h1>Simple Card View Model</h1>
<CardViewModel @model={{this.model}} />
{{!--
@title should using a named block
but Twiddle's version of Ember does not support this
--}}
<Card @title={{this.title}}>
{{this.content}}
</Card>
<div class="card">
<h2 class="card__title">
{{@title}}
</h2>
{{yield}}
</div>
{
"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"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment