Last active
July 22, 2016 12:05
-
-
Save HenryVonfire/e028a1f1bf6a1deeb3273a657a9c2f75 to your computer and use it in GitHub Desktop.
CSS for message with picture
This file contains hidden or 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:['chat-box'] | |
| }); |
This file contains hidden or 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', | |
| friendImage: "http://www.hdfreewallpapers.in/uploads/cache/1126823654/beautiful-pretty-girl-cute-face-red-lipstick-08qL-715x500-MM-100.jpg", | |
| userImage: "http://images.mentalfloss.com/sites/default/files/styles/article_640x430/public/catffaceheader.jpg", | |
| messages:[], | |
| actions:{ | |
| addMessage(){ | |
| let messages = this.get('messages'); | |
| let isUser = this.get('isUser'); | |
| let sameUser = false; | |
| if(messages.length > 0){ | |
| if(messages[messages.length-1].isUser === isUser){ | |
| sameUser = true; | |
| } | |
| } | |
| let text = this.get('text'); | |
| let userImage = this.get('userImage'); | |
| let friendImage = this.get('friendImage'); | |
| messages.pushObject({ | |
| isUser:isUser, | |
| text: text, | |
| image:isUser? userImage: friendImage, | |
| sameUser:sameUser | |
| }); | |
| this.set('text',null); | |
| } | |
| } | |
| }); |
This file contains hidden or 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: 12pt; | |
| } | |
| .chat-box{ | |
| background-color:lightgrey; | |
| width:400px; | |
| padding:10px; | |
| height: 500px; | |
| overflow-y:auto; | |
| display:flex; | |
| justify-content: flex-start; | |
| flex-direction: column; | |
| } | |
| .user-box{ | |
| position:relative; | |
| text-align:right; | |
| max-width:200px; | |
| background-color:#67a567; | |
| padding:10px 50px 10px 10px; | |
| border-radius:5px; | |
| margin: 30px 20px 0px auto; | |
| font-size:0.8em; | |
| color:white; | |
| justify-content: flex-end; | |
| } | |
| .user-box.without-image { | |
| padding:10px 10px 10px 10px; | |
| margin: 10px 20px 0px auto; | |
| } | |
| .message-box{ | |
| position:relative; | |
| max-width:200px; | |
| background-color:white; | |
| padding:10px 10px 10px 50px; | |
| border-radius:5px; | |
| margin: 30px auto 0px 20px; | |
| font-size:0.8em; | |
| color:#666; | |
| } | |
| .message-box.without-image { | |
| padding:10px 10px 10px 10px; | |
| margin: 10px auto 0px 20px; | |
| } | |
| .user-pic{ | |
| position:absolute; | |
| top:-15px; | |
| right:-25px; | |
| height:50px; | |
| width:50px; | |
| border-radius:50%; | |
| border:5px solid lightgrey; | |
| } | |
| .friend-pic{ | |
| position:absolute; | |
| top:-15px; | |
| left:-25px; | |
| height:50px; | |
| width:50px; | |
| border-radius:50%; | |
| border:5px solid lightgrey; | |
| } |
This file contains hidden or 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.9.3", | |
| "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.6.0", | |
| "ember-data": "2.6.1", | |
| "ember-template-compiler": "2.6.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment