forked from LRNWebComponents/lrndesign-paperstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lrndesign-paperstack.html
197 lines (187 loc) · 5 KB
/
lrndesign-paperstack.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../hax-behaviors/hax-behaviors.html">
<link rel="import" href="../materializecss-styles/materializecss-styles.html">
<link rel="import" href="../lrn-icons/lrn-icons.html">
<link rel="import" href="../paper-tooltip/paper-tooltip.html">
<link rel="import" href="../paper-swatch-picker/paper-swatch-picker.html">
<!--
`lrndesign-paperstack`
A LRN element
@demo demo/index.html
-->
<dom-module id="lrndesign-paperstack">
<template>
<style include="materializecss-styles"></style>
<style>
:host {
display: block;
}
/* Example card */
.egletter p {
position:relative;
z-index:3;
line-height:1.5rem;
}
.egletter ul {
position:relative;
z-index:3;
line-height:1.5rem;
}
.egletter h2,
.egletter h3,
.egletter h4,
.egletter h5,
.egletter h6 {
font-family: cursive;
margin: 0 auto;
position: relative;
z-index: 3;
line-height: 4em;
}
lrn-icon {
font-size: 1.2em;
height: 2em;
width: 2em;
margin: -.75em 0 0 .25em;
}
.icon-container {
float: left;
width: 3em;
height: 3em;
margin-right:.5em;
}
.egletter h2 span,
.egletter h3 span,
.egletter h4 span,
.egletter h5 span,
.egletter h6 span {
line-height: 3em;
}
.egletter {
margin: 1.5rem auto 0;
min-height: 10rem;
padding: .75rem 1.5rem;
position: relative;
width: 80%;
z-index:4;
margin-bottom: 3rem;
}
.egletter:before, .egletter:after {
content: "";
height: 98%;
position: absolute;
width: 100%;
z-index: 2;
}
.egletter:before {
background: #fafafa;
box-shadow: 0 0 .5rem rgba(0,0,0,0.2);
left: -.2rem;
top: .2rem;
transform: rotate(-2.5deg);
}
.egletter:after {
background: #ffffff;
box-shadow: 0 0 .2rem rgba(0,0,0,0.2);
right: -.2rem;
top: .1rem;
transform: rotate(1.4deg);
}
</style>
<div class="egletter">
<hax-editbar edit="{{edit}}">
<paper-swatch-picker id="itemcolor" color="{{colorCode}}"></paper-swatch-picker>
<paper-tooltip for="itemcolor">Background color</paper-tooltip>
<paper-swatch-picker id="textcolor" color="{{textColorCode}}"></paper-swatch-picker>
<paper-tooltip for="textcolor">Text color</paper-tooltip>
</hax-editbar>
<h3>
<div class$="icon-container circle {{color}}"><lrn-icon icon="{{icon}}" class$="{{textColor}}"></lrn-icon></div>
<span><hax-editable edit="{{edit}}" type="textfield">{{title}}</hax-editable></span>
</h3>
<p>
<hax-editable edit="{{edit}}" type="html">
<content></content>
</hax-editable>
</p>
</div>
</template>
<script>
Polymer({
is: 'lrndesign-paperstack',
behaviors: [HAXBehaviors.EditBehaviors, MaterializeCSSBehaviors.ColorBehaviors],
properties: {
/**
* heading title
*/
title: {
type: String,
value: 'Heading',
},
/**
* LRN icon
*/
icon: {
type: String,
value: 'assignment',
},
/**
* Color code
*/
colorCode: {
type: String,
observer: '_colorChange',
},
/**
* Color class
*/
color: {
type: String,
value: 'grey darken-4',
reflectToAttribute: true,
notify: true,
},
/**
* Text color code
*/
textColorCode: {
type: String,
observer: '_textColorChange',
},
/**
* Text color class
*/
textColor: {
type: String,
value: 'white-text',
reflectToAttribute: true,
notify: true,
},
},
/**
* Notice the color change and shift it over to the class name.
*/
_colorChange: function() {
if (this.colorCode.substring(0, 1) == '#') {
this.color = this._colorTransform(this.colorCode, '', '');
}
},
/**
* Text color change and shift it over to the class name.
*/
_textColorChange: function() {
if (this.textColorCode.substring(0, 1) == '#') {
this.textColor = this._colorTransform(this.textColorCode, '-text', 'text-');
}
},
/**
* Demo mode.
*/
_demoInit: function() {
this.innerHTML = "This is a great example, one of the best example I've ever seen. In fact, it's the best example ever produced and it says a lot about your content that you are about to see here.";
this.title = "A piece of content worth highlighting";
this.icon = 'assignment';
}
});
</script>
</dom-module>