-
Notifications
You must be signed in to change notification settings - Fork 1
/
stitch-order-form.html
91 lines (76 loc) · 1.9 KB
/
stitch-order-form.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/paper-styles/shadow.html">
<link rel="import" href="bower_components/paper-input/paper-input.html">
<link rel="import" href="bower_components/iron-image/iron-image.html">
<link rel="import" href="order-styles.html">
<dom-module id="stitch-order-form">
<template>
<style include="order-styles">
:host {
display: block;
color: var(--primary-text-color);
background-color: var(--primary-background-color);
margin: 10px;
padding: 22px 25px;
border-radius: 2px;
@apply(--shadow-elevation-2dp);
}
</style>
<header>
<h1>Order Product</h1>
<paper-input label="[[label]]" placeholder="[[placeholder]]"
value="{{productUrl}}" type="url"
error-message="Invalid URL" auto-validate>
</paper-input>
</header>
<div class="content">
<div class="left">
<iron-image placeholder="./placeholder.jpg"></iron-image>
</div>
<div class="right">
<h2>[[productDetails.Title]]</h2>
</div>
</div>
<div class="actions">
</div>
</template>
<script>
(function(){
'use strict';
Polymer({
is: 'stitch-order-form',
properties: {
label: {
type: String,
value: 'Paste the URL of the Amazon page here'
},
placeholder: {
type: String,
value: 'https://www.amazon.com/...'
},
/*
* USER SETTABLE PROPERTIES
* ========================
*/
productUrl: {
// On change, load new product details
type: String,
value: '',
notify: true
},
/*
* DERIVED PROPERTIES
* ========================
*/
productDetails: {
/* Depends on productUrl.
* Rough idea: parse the URL for the ASIN. Then use the amazon-produt-api NPM
* to grab the product details.
*/
type: Object
}
}
});
})();
</script>
</dom-module>