Skip to content

Commit

Permalink
fix(): Styles & point length
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfredo De la calle authored and Alfredo De la calle committed Dec 16, 2016
1 parent e6e91db commit 2b43050
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 33 deletions.
19 changes: 3 additions & 16 deletions key-pad-key-styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@

}

.key-pad-key__keyNum {
flex: 1 0 33.3%;
@apply(--layout);
@apply(--layout-center-justified);
}

.key-pad-key__keyNum:nth-of-type(10) {
flex-basis: 66.6%;
@apply(--layout-end-justified);
}

.key-pad-key__keyNum-content {
border: 1px solid #CCC;
border-radius: 50%;
Expand All @@ -24,14 +13,12 @@
width: 75px;
@apply(--layout;
@apply(--layout-center-center);
@apply(--key-pad-key-keynum-content);
}
/* .key-pad-key__keyNum:nth-of-type(10) .key-pad-key__keyNum-content {
margin-right: 20px;
}
*/

.key-pad-key__keyNum-content:hover {
cursor: pointer;
background-color: #CCC;
@apply(--key-pad-key-keynum-content);
}
</style>
</template>
Expand Down
2 changes: 1 addition & 1 deletion key-pad-key.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<dom-module id="key-pad-key">
<style include="key-pad-key-styles key-pad-key-animations"></style>
<template>
<div class$="key-pad-key__keyNum key-pad-key__[[ label ]]"
<div class$="[[ _computeClassKeypadKey() ]]"
on-tap="_onTapKey">
<div class="key-pad-key__keyNum-content">
<span>[[ label ]]</span>
Expand Down
4 changes: 4 additions & 0 deletions key-pad-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Polymer({
this.updateStyles();
},

_computeClassKeypadKey: function() {
return 'key-pad-key__keyNum key-pad-key__' + this.label;
},

_onTapKey: function(evt) {
this.fire('key-pad-key:key', this.key);
console.log('key-pad-key:key', this.key);
Expand Down
12 changes: 12 additions & 0 deletions key-pad-styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,21 @@
}

.key-pad__keyNums {
font-size: 16px;
@apply(--layout);
@apply(--layout-wrap);
@apply(--key-pad-nums);
}

.key-pad__keyNums > *:not(template) {
flex: 1 0 33.3%;
@apply(--layout);
@apply(--layout-center-justified);
}

.key-pad__keyNums >*:nth-child(10) {
flex-basis: 66.6%;
}
</style>
</template>
</dom-module>
Expand Down
4 changes: 2 additions & 2 deletions key-pad.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

<header class="key-pad__containerPoints">
<div class="key-pad__points">
<template is="dom-repeat" items="{{ _getInputLength(maxLength) }}">
<div class="key-pad__point key-pad__point--[[index + 1]]"></div>
<template is="dom-repeat" items="[[ _getInputLength(maxLength) ]]">
<div class$="[[ _computeClassKeypadPoint(index) ]]"></div>
</template>

<!-- <div class="key-pad__point key-pad__point--selected key-pad__point--1"></div> -->
Expand Down
21 changes: 7 additions & 14 deletions key-pad.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ Polymer({
type: Boolean
},

_keyLength: {
type: Number,
value: 0
},

_keypadNums: {
type: Array
}
Expand All @@ -84,17 +79,10 @@ Polymer({
attached: function() {
var shuffle = !!this.shuffle ? false : true;
this.set('_keypadNums', this._getRandomNumbers(shuffle));


},

destroy: function() {
this.unlisten(keys, 'key-pad-key:key');
},

reset: function() {
this._setModel('');
this.set('_keyLength', 0);
},

_getInputLength: function() {
Expand All @@ -107,14 +95,19 @@ Polymer({

},

// Compute clases
_computeClassKeypadPoint: function(index) {
var idx = index + 1;
return 'key-pad__point key-pad__point--' + idx.toString();
},

////// EVENTS
_onKeypadKey: function(evt, detail) {
//TODO: Check characters
var keyValue = detail.toString();

if (this._keyLength < this.maxLength) {
if (this.model.length < this.maxLength) {
this._setModel(this.model + keyValue);
this._keyLength++;
}
},

Expand Down

0 comments on commit 2b43050

Please sign in to comment.