feat: blog (#4653)

* feat: blog

* feat: creator withdraw overhaul blog

* fix: bullet points

* fix: title

* fix: blog

* feat: autoplay on scroll & fix encoding of videos

* fix: class on first video

* fix: authors + summary + title

* fix: title + summary

* fix: lint

* fix: rev page mp4

* update formatting + phrasing

* some more formatting changes

* unify hr colors

* update opening line

* update blog time

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2025-10-27 23:19:35 +00:00
committed by GitHub
parent a0f23a2bca
commit 363f47f269
17 changed files with 212 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import { articles as rawArticles } from '@modrinth/blog'
import { Avatar, ButtonStyled } from '@modrinth/ui'
import type { User } from '@modrinth/utils'
import dayjs from 'dayjs'
import { computed } from 'vue'
import { computed, onMounted } from 'vue'
import NewsletterButton from '~/components/ui/NewsletterButton.vue'
import ShareArticleButtons from '~/components/ui/ShareArticleButtons.vue'
@@ -74,6 +74,36 @@ useSeoMeta({
twitterCard: 'summary_large_image',
twitterImage: () => thumbnailPath.value,
})
onMounted(() => {
const videos = document.querySelectorAll('.markdown-body video')
if ('IntersectionObserver' in window) {
const videoObserver = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
const video = entry.target as HTMLVideoElement
if (entry.isIntersecting) {
video.play().catch(() => {})
} else {
video.pause()
}
})
},
{
threshold: 0.5,
},
)
videos.forEach((video) => {
videoObserver.observe(video)
})
} else {
videos.forEach((video) => {
;(video as HTMLVideoElement).setAttribute('autoplay', '')
})
}
})
</script>
<template>
@@ -181,14 +211,19 @@ useSeoMeta({
padding: 0;
}
ul,
ul > li:not(:last-child),
ol > li:not(:last-child) {
margin-bottom: 0.5rem;
}
ul,
ol {
p {
> li > p {
margin-top: 0;
margin-bottom: 0;
}
> li > p:not(:last-child) {
margin-bottom: 0.5rem;
}
}
@@ -220,20 +255,22 @@ useSeoMeta({
h2 {
font-size: 1.25rem;
margin-top: 1.5rem;
@media (min-width: 640px) {
font-size: 1.5rem;
}
}
h3 {
font-size: 1.125rem;
font-size: 1rem;
margin-top: 1.25rem;
@media (min-width: 640px) {
font-size: 1.25rem;
font-size: 1.125rem;
}
}
p {
margin-bottom: 1.25rem;
margin-bottom: 0.75rem;
font-size: 0.875rem;
@media (min-width: 640px) {
font-size: 1rem;
@@ -275,8 +312,34 @@ useSeoMeta({
}
}
hr {
border: none;
height: 1px;
background-color: var(--color-divider);
}
.video-wrapper {
display: inline-block;
max-width: 100%;
border-radius: var(--radius-md);
overflow: hidden;
border: 1px solid var(--color-button-border);
@media (min-width: 640px) {
border-radius: var(--radius-lg);
}
video {
display: block;
max-width: 100%;
object-fit: cover;
height: auto;
}
}
> img,
> :has(img:first-child:last-child) {
> .video-wrapper,
> :has(img:first-child:last-child),
> :has(video:first-child:last-child) {
display: flex;
justify-content: center;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -1,5 +1,12 @@
{
"articles": [
{
"title": "More Ways to Withdraw",
"summary": "Coming soon: new withdraw options and a redesigned revenue dashboard",
"thumbnail": "https://modrinth.com/news/article/creator-withdrawals-overhaul/thumbnail.webp",
"date": "2025-10-27T23:30:00.000Z",
"link": "https://modrinth.com/news/article/creator-withdrawals-overhaul"
},
{
"title": "Standing By Our Values",
"summary": "Keeping LGBTQIA+ content visible despite demands from Russia.",

File diff suppressed because one or more lines are too long