Last active
May 29, 2020 16:31
-
-
Save camskene/f7701113ca2d7c230011ebc3d09a1c52 to your computer and use it in GitHub Desktop.
Card API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
import { capitalize } from '@ember/string'; | |
export default class extends Component { | |
get cardAttributes() { | |
let attributes = { | |
'title': this.args.card.attributes.title, | |
'list-key-value': this.listKeyValue, | |
}; | |
return Object | |
.entries(attributes) | |
.reduce((a,[k,v]) => (v ? {...a, [k]:v} : a), {}); | |
} | |
get listKeyValue() { | |
let { listKeyValue } = this.args.card.attributes; | |
if (!listKeyValue) return; | |
let keys = Object.keys(listKeyValue); | |
let attribute = keys.map((key) => { | |
return { | |
key: capitalize(key), | |
value: listKeyValue[key], | |
} | |
}); | |
return attribute; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
export default class extends Component { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
export default class extends Component { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
car = { | |
attributes: { | |
title: 'Car', | |
listKeyValue: { | |
make: 'Honda', | |
model: 'Pilot', | |
}, | |
}, | |
} | |
dog = { | |
attributes: { | |
title: 'Dog', | |
listKeyValue: { | |
species: 'Dog', | |
breed: 'Border Collie', | |
}, | |
}, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": true, | |
"_APPLICATION_TEMPLATE_WRAPPER": false, | |
"_JQUERY_INTEGRATION": false | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"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