Skip to content

Commit 45900da

Browse files
committed
💄 Update Apod.vue to new API
1 parent bbb0f16 commit 45900da

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/components/Widgets/Apod.vue

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
2-
<div class="apod-wrapper" v-if="image">
2+
<div class="apod-wrapper" v-if="url">
33
<a :href="link" class="title" target="__blank" title="View Article">
44
{{ title }}
55
</a>
6-
<a :href="hdImage" title="View HD Image" class="picture" target="__blank">
7-
<img :src="image" :alt="title" />
6+
<a :href="hdurl" title="View HD Image" class="picture" target="__blank">
7+
<img :src="url" :alt="title" />
88
</a>
99
<p class="copyright">{{ copyright }}</p>
10-
<p class="description">{{ truncatedDescription }}</p>
10+
<p class="explanation">{{ truncatedExplanation }}</p>
1111
<p @click="toggleShowFull" class="expend-details-btn">
12-
{{ showFullDesc ? $t('widgets.general.show-less') : $t('widgets.general.show-more') }}
12+
{{ showFullExp ? $t('widgets.general.show-less') : $t('widgets.general.show-more') }}
1313
</p>
1414
</div>
1515
</template>
@@ -24,17 +24,17 @@ export default {
2424
data() {
2525
return {
2626
title: null,
27-
image: null,
28-
hdImage: null,
29-
link: null,
30-
description: null,
27+
url: null,
28+
hdurl: null,
29+
link: 'https://apod.nasa.gov/apod/astropix.html',
30+
explanation: null,
3131
copyright: null,
32-
showFullDesc: false,
32+
showFullExp: false,
3333
};
3434
},
3535
computed: {
36-
truncatedDescription() {
37-
return this.showFullDesc ? this.description : `${this.description.substring(0, 100)}...`;
36+
truncatedExplanation() {
37+
return this.showFullExp ? this.explanation : `${this.explanation.substring(0, 100)}...`;
3838
},
3939
},
4040
methods: {
@@ -52,14 +52,14 @@ export default {
5252
},
5353
processData(data) {
5454
this.title = data.title;
55-
this.image = data.url;
56-
this.hdImage = data.hdurl;
57-
this.link = data.apod_site;
58-
this.description = data.description;
55+
this.url = data.url;
56+
this.hdurl = data.hdurl;
57+
this.link = data.link;
58+
this.explanation = data.explanation;
5959
this.copyright = data.copyright;
6060
},
6161
toggleShowFull() {
62-
this.showFullDesc = !this.showFullDesc;
62+
this.showFullExp = !this.showFullExp;
6363
},
6464
},
6565
};
@@ -85,7 +85,7 @@ export default {
8585
opacity: var(--dimming-factor);
8686
color: var(--widget-text-color);
8787
}
88-
p.description {
88+
p.explanation {
8989
color: var(--widget-text-color);
9090
font-size: 1rem;
9191
margin: 0.5rem 0;

0 commit comments

Comments
 (0)