@politicalwatch/tipi-uikit 1.6.11 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@politicalwatch/tipi-uikit",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "main": "src/components/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="c-party_logo_icon" :style="getBackground">
3
3
  <figure class="c-party_logo_icon__image" :alt="'Logo de ' + getName">
4
- <i v-html="svg" />
4
+ <component :is="svg"></component>
5
5
  </figure>
6
6
  </div>
7
7
  </template>
@@ -16,10 +16,6 @@ export default {
16
16
  },
17
17
  data: function () {
18
18
  return {
19
- icons: import.meta.glob('../../assets/party_logos/icon/*.svg', {
20
- as: 'raw',
21
- eager: true,
22
- }),
23
19
  parties: {
24
20
  Cs: {
25
21
  name: 'Ciudadanos',
@@ -31,6 +27,11 @@ export default {
31
27
  logo: 'vox',
32
28
  color: '#5ac035',
33
29
  },
30
+ Vox: {
31
+ name: 'VOX',
32
+ logo: 'vox',
33
+ color: '#5ac035',
34
+ },
34
35
  ERC: {
35
36
  name: 'Esquerra Republicana',
36
37
  logo: 'erc',
@@ -166,6 +167,11 @@ export default {
166
167
  logo: 'psoe',
167
168
  color: '#e30613',
168
169
  },
170
+ 'PSIB-PSOE': {
171
+ name: 'Partido Socialista Obrero Español',
172
+ logo: 'psoe',
173
+ color: '#e30613',
174
+ },
169
175
  'EAJ-PNV': {
170
176
  name: 'Partido Nacionalista Vasco',
171
177
  logo: 'pnv',
@@ -181,15 +187,19 @@ export default {
181
187
  },
182
188
  computed: {
183
189
  svg() {
184
- // let svg;
185
- // if (this.party in this.parties) {
186
- // svg = defineAsyncComponent(() => this.icons[`${this.parties[this.party].logo}.svg`]());
187
- // } else {
188
- // svg = defineAsyncComponent(() => import('../../assets/svg/icon-error.svg'));
189
- // }
190
- return this.party in this.parties
191
- ? this.icons[`${this.parties[this.party].logo}.svg`]
192
- : this.icons['party-error.svg'];
190
+ let svg = '';
191
+ try {
192
+ if (this.party in this.parties) {
193
+ svg = defineAsyncComponent(() =>
194
+ import(`../../assets/party_logos/icon/${this.parties[this.party].logo}.svg`)
195
+ );
196
+ } else {
197
+ svg = defineAsyncComponent(() => import('../../assets/svg/icon-error.svg'));
198
+ }
199
+ } catch (error) {
200
+ svg = this.icon;
201
+ }
202
+ return svg;
193
203
  },
194
204
  getBackground: function () {
195
205
  const bg = this.parties[this.party]?.color ? this.parties[this.party].color : '#f4f6f8';