Skip to content

Instantly share code, notes, and snippets.

@22a
Forked from patocallaghan/components.ic-card-list.js
Created October 18, 2018 16:18
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 22a/9ea8674e8119f3b9b6445d90f55ba12f to your computer and use it in GitHub Desktop.
Save 22a/9ea8674e8119f3b9b6445d90f55ba12f to your computer and use it in GitHub Desktop.
ic-card
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['ic-card__section'],
classNameBindings: ['paddingClass'],
paddingClass: Ember.computed('padding', function() {
if (this.get('padding')) {
return `o__${this.get('padding')}-padding`;
} else {
return '';
}
}),
});
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['ic-card'],
classNameBindings: ['paddingClass', 'interactivityClass'],
paddingClass: Ember.computed('padding', function() {
if (this.get('padding')) {
return `o__${this.get('padding')}-padding`;
} else {
return '';
}
}),
interactivityClass: Ember.computed('isInteractive', function() {
if (this.get('isInteractive')) {
return 'o__interactive';
} else {
return '';
}
}),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'ic-card demo'
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.ic-card {
border: 1px solid rgba(0,0,0,.2);
border-radius: 4px;
transition: box-shadow linear 40ms, border-color linear .2s;
overflow: hidden;
}
.ic-card.o__interactive:hover {
border-color: #286efa;
box-shadow: 0 4px 14px 0 rgba(5,73,209,.1);
cursor: pointer;
}
.ic-card__section.o__compact-padding,
.ic-card.o__compact-padding {
padding: 12px;
}
.ic-card__section.o__regular-padding,
.ic-card.o__regular-padding {
padding: 20px;
}
{{#ic-card padding="regular"}}
Card body text
{{/ic-card}}
<hr style="padding-bottom: 20px; border: none">
{{#ic-card padding="regular" isInteractive=true}}
Hoverable card
{{/ic-card}}
<hr style="padding-bottom: 20px; border: none">
{{#ic-card as |c|}}
{{#c.section padding="compact"}}
Section body text with compact padding
{{/c.section}}
{{/ic-card}}
<hr style="padding-bottom: 20px; border: none">
{{#ic-card as |c|}}
{{#c.section padding="none"}}
<div style="background: linear-gradient(to right, #83a4d4, #b6fbff); height: 80px">
<!--this could be an image or some other full bleed content-->
</div>
{{/c.section}}
{{#c.section padding="regular"}}
Section body text
{{/c.section}}
{{/ic-card}}
{{yield (hash card=(component 'ic-card' class="u__m__20"))}}
{{yield (hash
section=(component 'ic-card-section'
)
)}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment