diff --git a/src/components/Widgets/HackernewsTrending.vue b/src/components/Widgets/HackernewsTrending.vue index dad694fd..1698150a 100644 --- a/src/components/Widgets/HackernewsTrending.vue +++ b/src/components/Widgets/HackernewsTrending.vue @@ -6,12 +6,10 @@

{{ trendingPosts.title }}

-
- -
+

score: {{ trendingPosts.score }}

@@ -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); + }, }, }; @@ -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; } } } }