Skip to content

Instantly share code, notes, and snippets.

@asvny
Last active June 10, 2017 03:59
Show Gist options
  • Save asvny/028c982ca8153a09582349e5c2a12764 to your computer and use it in GitHub Desktop.
Save asvny/028c982ca8153a09582349e5c2a12764 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
classNames:['ui-input'],
classNameBindings:[
'isFilled:has-value'
],
currentValue: '',
isFilled: Ember.computed.notEmpty('currentValue'),
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
* {
box-sizing: border-box;
}
.ui-input { position: relative }
.ui-input > input{
position: relative;
height: 50px;
border:1px solid #a7a7a7;
border-radius:2px;
outline: 0;
width:200px;
font-size:16px;
padding-left:15px
}
.ui-input > label{
position: absolute;
line-height: 50px;
left:15px;
font-size: 14px;
pointer-events:none;
opacity:0.5;
transition: all .25s
}
.ui-input > input:focus ,
.ui-input.has-value > input {
padding-top: 15px
}
.ui-input > input:focus + label,
.ui-input.has-value > input + label {
transform: scale(0.8) translate(-12px,-15px);
opacity:1;
}
<br>
<br>
{{ui-input label="E-Mail Address"
kind="input"
type="url"
required=true
error="Please provide valid email"
}}
{{outlet}}
<br>
<br>
<input id="test"
required={{required}}
value={{currentValue}}
type={{type}}
oninput={{action (mut currentValue 'target.value')
value='target.value' }} />
<label for="test">{{label}} </label>
{
"version": "0.10.5",
"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.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment