Forked from GavinJoyce/components.create-segment-modal.js
Created
February 1, 2018 15:47
-
-
Save cspanring/080211bf743f558bb48c0065551d6a41 to your computer and use it in GitHub Desktop.
Modal 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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
hasName: Ember.computed.notEmpty('name'), | |
actions: { | |
log(message) { | |
console.log(message); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
let Item = Ember.Object.extend({ | |
title: 'Untitled', | |
isComplete: false, | |
showSidebar: false | |
}); | |
export default Ember.Component.extend({ | |
init() { | |
this._super(...arguments); | |
this.set('items', [ | |
Item.create({ title: 'Buy milk' }), | |
Item.create({ title: 'Run 10k' }), | |
Item.create({ title: 'Have a pint', isComplete: true }), | |
]); | |
}, | |
outstandingItems: Ember.computed.filterBy('items', 'isComplete', false), | |
completedItems: Ember.computed.filterBy('items', 'isComplete', true), | |
actions: { | |
log(message) { | |
window.alert(message); | |
}, | |
toggleSidebar() { | |
this.toggleProperty('showSidebar'); | |
}, | |
add() { | |
this.get('items').pushObject( | |
Item.create({ title: 'Have another pint' }), | |
); | |
}, | |
clear() { | |
let completed = this.get('completedItems'); | |
let items = this.get('items'); | |
items.removeObjects(completed); | |
}, | |
clearAll() { | |
this.set('items', Ember.A()); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: 'body' | |
}); |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: 'header', | |
title: '<untitled>' | |
}); |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: 'modal', | |
confirmButtonText: 'OK', | |
cancelButtonText: 'Cancel', | |
confirmButtonType: 'positive', | |
cancelButtonType: 'cancel', | |
sidebarIsVisible: false, | |
init() { | |
this._super(...arguments); | |
this.publicActions = { | |
showSidebar: () => this.send('showSidebar'), | |
hideSidebar: () => this.send('hideSidebar') | |
}; | |
}, | |
publicAPI: Em.computed('sidebarIsVisible', function() { | |
return { | |
sidebarIsVisible: this.get('sidebarIsVisible'), | |
actions: this.get('publicActions') | |
}; | |
}), | |
actions: { | |
showSidebar() { | |
this.set('sidebarIsVisible', true); | |
}, | |
hideSidebar() { | |
this.set('sidebarIsVisible', false); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
log(message) { | |
window.alert(message); | |
} | |
} | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 14pt; | |
background-color: #f7fafc; | |
color: #37474F; | |
} | |
h2 { | |
font-size: 16px; | |
line-height: 24px; | |
font-weight: 700; | |
color: #37474f; | |
margin: 0; | |
padding: 0; | |
} | |
hr { | |
margin: 40px; | |
} | |
.modal { | |
width: 100%; | |
max-width: 520px; | |
background: #fff; | |
border-radius: 3px; | |
box-shadow: 0 1px 20px 0 rgba(0,0,0,.2); | |
margin: 0 auto; | |
} | |
.header { | |
padding: 12px; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-flex-direction: row; | |
-ms-flex-direction: row; | |
flex-direction: row; | |
-webkit-flex-wrap: wrap; | |
-ms-flex-wrap: wrap; | |
flex-wrap: wrap; | |
} | |
.header .left { | |
-webkit-flex: 1; | |
-ms-flex: 1; | |
flex: 1; | |
min-width: -webkit-min-content; | |
min-width: -moz-min-content; | |
min-width: min-content; | |
} | |
.header .button { | |
float: left; | |
position:relative; | |
} | |
.header .title { | |
padding: 4px 10px; | |
text-align: center; | |
} | |
.header .right { | |
flex: 1; | |
min-width: min-content; | |
} | |
.header .right a { | |
float: right !important; | |
} | |
.footer { | |
padding: 12px; | |
text-align: right; | |
} | |
.body-container { | |
display: flex; | |
} | |
.sidebar { | |
border-right: 1px solid #ccc; | |
padding: 10px; | |
width: 120px; | |
padding: 30px; | |
font-size: 14px; | |
background-color: #f7fafc; | |
text-align: center; | |
box-shadow: inset 0 1px 1px 0 rgba(9,23,30,.15), inset 0 -1px 0 0 rgba(9,23,30,.12); | |
} | |
.body { | |
padding: 30px; | |
font-size: 14px; | |
background-color: #f7fafc; | |
flex: 1; | |
box-shadow: inset 0 1px 1px 0 rgba(9,23,30,.15), inset 0 -1px 0 0 rgba(9,23,30,.12); | |
} | |
button { | |
border: 1px solid rgba(0,0,0,.2); | |
border-radius: 3px; | |
padding: 5px 18px 7px; | |
display: inline-block; | |
cursor: pointer; | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
box-sizing: border-box; | |
transition: box-shadow linear 40ms; | |
} | |
button:disabled { | |
opacity: .5; | |
pointer-events: none; | |
} | |
button.normal { | |
background-color: #fff; | |
} | |
button.cancel { | |
background-color: #f5f5f5; | |
} | |
button.destructive { | |
background-color: red; | |
color: white; | |
} | |
button.positive{ | |
color: white; | |
background-color: #1f8ceb; | |
} | |
button.positive:hover { | |
background-color: #1271c4; | |
} |
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.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": { | |
"ember-assign-helper": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment