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
|
<!DOCTYPE html>
<html>
<head>
<script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<script src="../../../bower_components/d3/d3.js"></script>
<link rel="import" href="../tf-categorizer.html">
<link rel="import" href="../../../bower_components/iron-flex-layout/classes/iron-flex-layout.html">
</head>
<body>
<style>
</style>
<dom-module id="x-demo">
<style>
.container {
width: 255px;
padding: 10px;
border: 1px solid var(--paper-indigo-900);
border-radius: 5px;
position: fixed;
}
:host {
margin: 0px;
}
.categories {
font-family: "RobotoDraft",Helvetica;
margin-left: 300px;
width: 500px;
border: 1px solid var(--paper-indigo-500);
border-radius: 5px;
}
.category {
background-color: var(--paper-indigo-50);
margin: 20px;
padding: 20px;
border-radius: 5px;
}
.cat-name {
font-size: 20px;
}
.tag {
border-radius: 5px;
padding: 5px;
margin: 5px;
background-color: var(--paper-indigo-900);
color: white;
}
</style>
<template>
<div class="container">
<tf-categorizer categories="{{categories}}" tags="[[tags]]" id="demo"></tf-categorizer>
</div>
<div class="categories">
<template is="dom-repeat" items="[[categories]]">
<div class="category">
<p class="cat-name">Category: <span>[[item.name]]</span></p>
<div class="tags-container layout horizontal wrap">
<template is="dom-repeat" items="[[item.tags]]">
<span class="tag layout vertical center-center">[[item]]</span>
</template>
</div>
</template>
</div>
</template>
<script>
function tagsGenerator() {
var tags = ["special1", "special2", "special3", "special4", "special5"];
["l1", "l2", "l3", "l4", "l5"].forEach(function(l) {
["foo", "bar", "baz", "boink", "zod", "specialx"].forEach(function(x) {
tags.push(l + "/" + x);
});
});
return tags;
}
Polymer({
is: "x-demo",
properties: {
tags: { type: Array, value: tagsGenerator },
},
});
</script>
</dom-module>
<x-demo id="demo"></x-demo>
</body>
<script>
HTMLImports.whenReady(function() {
window.demo = document.getElementById("demo");
})
</script>
</html>
|