-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbx-license-plate.html
205 lines (172 loc) · 5.73 KB
/
bbx-license-plate.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
198
199
200
201
202
203
204
205
<!--
This file is part of the BBx-Kitchen/bbx-license-plate
(c) Basis Europe <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<link rel="import" href="../polymer/polymer.html">
<!--
## BBX License Plate
A polymer built element that represents license plate templates for **Germany** and **Netherlands**.
The chosen layout shows two dashes in between the digits for Netherlands and no-dashes for the German representation.
The width can be freely adjustable and the correct height is automatically calculated.
## Example
```html
<bbx-license-plate plate-Number="HH KL 775">
</bbx-license-plate>
<bbx-license-plate plate-Number="64-GS-HR" plate-width="400px">
</bbx-license-plate>
```
@demo demo/index.html
@hero hero.svg
-->
<dom-module id="bbx-license-plate">
<template>
<style>
@font-face {
font-family: 'Conv_GL-Nummernschild-Eng';
src: url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/GL/GL-Nummernschild-Eng.eot');
src: local('☺'), url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/GL/GL-Nummernschild-Eng.woff') format('woff'),
url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/GL/GL-Nummernschild-Eng.ttf') format('truetype'),
url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/GL/GL-Nummernschild-Eng.svg') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Conv_Kenteken';
src: url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/Kenteken/Kenteken.eot');
src: local('☺'), url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/Kenteken/Kenteken.woff') format('woff'),
url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/Kenteken/Kenteken.ttf') format('truetype'),
url('https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/fonts/Kenteken/Kenteken.svg') format('svg');
font-weight: normal;
font-style: normal;
}
:host {
@apply(--bbx-license-plate-style);
/* margin: 0 2px; */
--plate-width: 200px;
}
.plate {
display: flex;
position: relative;
background-color: transparent;
/* box-shadow: 0 0 0 calc(var(--plate-width) * 0.01) white; */
width: var(--plate-width);
text-align: center;
text-transform: uppercase;
font-family: Roboto, Sans-Serif;
font-weight: 500;
border: black solid calc(var(--plate-width) * 0.01);
border-radius: calc(var(--plate-width) * 0.02);
overflow: hidden;
color: var(--plate-color, black);
}
.plate>.country {
position: relative;
flex: 10%;
background-color: #003399;
bottom: 0;
top: 0;
}
.plate>.country>.letter {
position: absolute;
width: 100%;
bottom: 3%;
color: white;
}
.plate>.country>.letter.NL {
font-size: calc(var(--plate-width)/(390/110) * 0.25);
}
.plate>.country>.letter.D {
font-size: calc(var(--plate-width)/(350/110) * 0.25);
}
.plate>.country>.european_logo {
position: absolute;
text-align: center;
width: 100%;
/* top: 2%; */
top: 30%;
}
.plate>.country>.european_logo>img {
width: 70%;
/*FIX for small license plates*/
position: absolute;
/* top: 2px; */
left: 15%;
}
.plate>.number {
flex: 85%;
line-height: calc(var(--plate-width) / (520 / 110));
}
.plate>.number.NL {
font-family: 'Conv_Kenteken', Sans-Serif !important;
background-color: #FFCB03;
box-shadow: 0 0 0 calc(var(--plate-width) * 0.01) #FFCB03;
font-size: calc(var(--plate-width)/(440/110) * 0.6);
}
.plate>.number.D {
font-family: 'Conv_GL-Nummernschild-Eng', Sans-Serif !important;
background-color: white;
box-shadow: 0 0 0 calc(var(--plate-width) * 0.01) white;
font-size: calc(var(--plate-width)/(250/110) * 0.6);
}
.letter::after {
content: "";
}
.NL .letter::after {
content: "NL";
}
.D .letter::after {
content: "D";
}
</style>
<div class$="plate {{_plateCountry}}">
<div class="country">
<div class="european_logo">
<img src="https://cdn.jsdelivr.net/gh/BBx-Kitchen/[email protected]/images/eu_stars.svg" />
</div>
<!-- <div class$="letter {{_plateCountry}}"></div> -->
</div>
<div class$="number {{_plateCountry}}">{{plateNumber}}</div>
</div>
</template>
<script>
Polymer({
is: 'bbx-license-plate',
properties: {
/**
* Plate Number
*
* @type {String}
*/
plateNumber: {
type: String,
value: ""
},
/**
* Plate Width
*
* @type {String}
*/
plateWidth: {
type: String,
value: "200px",
observer: "_plateWidthChanged"
},
_plateCountry: {
type: String,
computed: '_computePlateCountry(plateNumber)'
}
},
_computePlateCountry: function (plateNumber) {
var dashArray = plateNumber.match(/-/g);
if (dashArray && dashArray.length > 1) return 'NL'
else return 'D';
},
_plateWidthChanged: function (newValue, oldValue) {
this.customStyle['--plate-width'] = newValue;
this.updateStyles();
}
});
</script>
</dom-module>