🚨 ⚰️ remove unused css, fix linting issues in HN

This commit is contained in:
Josua Blejeru 2023-05-24 12:25:03 +02:00
parent 503d662065
commit 7e1057d059
1 changed files with 12 additions and 42 deletions

View File

@ -6,12 +6,10 @@
<a class="post-top" :href="trendingPosts.originURL">
<div class="post-title-wrap">
<p class="post-title">{{ trendingPosts.title }}</p>
<div class="score-wrap">
<p class="post-date">
{{ formatDate(trendingPosts.time) }}
</p>
<p class="post-date" v-if="trendingPosts.score">score: {{ trendingPosts.score }}</p>
</div>
<p class="post-score" v-if="trendingPosts.score">score: {{ trendingPosts.score }}</p>
</div>
</a>
</div>
@ -53,20 +51,19 @@ export default {
const allData = topPosts.map((post) => {
const url = `${widgetApiEndpoints.hackernewsTrending}/item/${post}.json`;
return this.makeRequest(url);
})
});
Promise.all(allData).then((resolvedPostValues) => {
this.trendingPosts = resolvedPostValues.map((element, index) => {
element.originURL = `https://news.ycombinator.com/item?id=${topPosts.at(index)}`
return element
const trendingPost = { ...element, originURL: `https://news.ycombinator.com/item?id=${topPosts.at(index)}` };
return trendingPost;
});
console.log(this.trendingPosts)
});
},
formatDate(unixTime) {
const date = new Date(unixTime * 1000);
// Then specify how you want your dates to be formatted
return new Intl.DateTimeFormat('default', {dateStyle: 'long'}).format(date);
}
const date = new Date(unixTime * 1000);
// Then specify how you want your dates to be formatted
return new Intl.DateTimeFormat('default', { dateStyle: 'long' }).format(date);
},
},
};
</script>
@ -117,39 +114,12 @@ export default {
opacity: var(--dimming-factor);
color: var(--widget-text-color);
}
img.post-img {
border-radius: var(--curve-factor);
width: 2rem;
height: 2rem;
margin-right: 0.5rem;
}
}
.post-body {
font-size: 0.85rem;
color: var(--widget-text-color);
max-height: 400px;
overflow: hidden;
::v-deep p {
margin: 0.5rem 0;
}
::v-deep img {
max-width: 80%;
display: flex;
margin: 0 auto;
border-radius: var(--curve-factor);
}
::v-deep a {
p.post-score {
font-size: 0.8rem;
margin: 0;
opacity: var(--dimming-factor);
color: var(--widget-text-color);
}
::v-deep svg path {
fill: var(--widget-text-color);
}
::v-deep blockquote {
margin-left: 0.5rem;
padding-left: 0.5rem;
border-left: 4px solid var(--widget-text-color);
}
::v-deep .avatar.avatar-user { display: none; }
}
}
}