Skip to content

Instantly share code, notes, and snippets.

@marcus7777
Forked from akki777-zz/index.html
Last active March 22, 2016 11:34
Show Gist options
  • Save marcus7777/bf70fef8496e49d369f4 to your computer and use it in GitHub Desktop.
Save marcus7777/bf70fef8496e49d369f4 to your computer and use it in GitHub Desktop.
Trial on paper-swatch-picker
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/iron-icons/maps-icons.html">
<link rel="import" href="/bower_components/neon-animation/animations/scale-up-animation.html">
<link rel="import" href="/bower_components/neon-animation/animations/fade-out-animation.html">
<link rel="import" href="/bower_components/paper-swatch-picker/paper-swatch-picker.html">
<dom-module id="add-label">
<template>
<paper-dialog entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop>
<center>
<h2>Create a new Label</h2>
</center>
<iron-icon icon="maps:local-offer" style="width:100px;height:100px;color: {{picked}};float:left;"></iron-icon>
<div style="float:right;">
<paper-input id="input" error-message="This field cannot be empty" placeholder="eg. Work" value="{{labelName}}" style="margin-bottom:16px;float:left;"></paper-input>
<paper-swatch-picker color="{{picked}}" style="float:right;margin-top:10px;"></paper-swatch-picker>
</div>
<br/>
<div class="buttons">
<paper-button dialog-dismiss style="color:#666;">Cancel</paper-button>
<paper-button on-click="newLabel" style="color:#ff4081;">Save</paper-button>
</div>
<br/>
</paper-dialog>
</template>
<script>
Polymer({
is: 'add-label',
properties: {
picked: {
value: "#2198F3"
}
},
ready: function(){
this.labelName = '';
},
open: function() {
this.querySelector('paper-dialog').open();
},
close: function() {
this.querySelector('paper-dialog').close();
},
newLabel: function(){
console.log("name: " + this.labelName + " color: " + this.$.colorPicker.color);
this.close();
}
});
</script>
</dom-module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment