Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
louderthan10 committed Nov 20, 2024
2 parents 1339e57 + cde9eb5 commit 2df119e
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fill: null
format: webp
handle: hero
height: 1080
interlace: none
mode: crop
name: Hero
position: center-center
quality: 60
upscale: true
width: 2048
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ format: null
handle: wide
height: 1080
interlace: plane
mode: fit
mode: crop
name: Wide
position: center-center
quality: 30
Expand Down
3 changes: 2 additions & 1 deletion backend/config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dateModified: 1732074647
dateModified: 1732089349
elementSources:
craft\elements\Entry:
-
Expand Down Expand Up @@ -149,6 +149,7 @@ meta:
58ccb571-6c72-449f-8e7b-6f43c5d416b3: 'Starter Nuxt' # Starter Nuxt
70b2614b-639a-4de2-8c11-3851d36d6f8c: 'Blog categories' # Blog categories
163c895f-0c05-4845-80e2-043b2346d830: Address # Address
0413e9dc-1c8a-4221-b81d-c9f6c0594cbd: Hero # Hero
697da4c2-e02f-4f49-9d76-e22609ceda25: Page # Page
998bf681-e007-4f7e-a525-863e01a38560: Blog # Blog
5358db38-27c0-49b4-b9d3-e68326e79da2: Image # Image
Expand Down
25 changes: 25 additions & 0 deletions frontend/components/image.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup>
const props = defineProps({
image: {
type: String,
required: true
}
})
}
const getPhotoUrl = (photo, width) => {
return `${photo.url}?width=${width}`
}
</script>

<template>
<picture>
<source data-sizes="100vw" />
<img
:src="image.url"
:srcset="image.srcset"
:alt="image.alt"
sizes="100vw"
/>
</picture>
</template>
67 changes: 36 additions & 31 deletions frontend/components/teaser.vue
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
<script setup>
const props = defineProps({
id: {
type: Number,
required: true,
default: 0
},
title: {
type: String,
required: true
},
uri: {
type: String,
entry: {
type: Object,
required: true
},
pageSubheading: {
type: String,
required: false,
default: ''
},
postDate: {
type: String,
required: true
featured: {
type: Boolean,
default: false
}
});
</script>

<template>
<article class="py-6">
<h2 class="text-4xl font-bold">
<NuxtLink
:to="`${uri}`"
class="text-red-600 hover:underline focus:underline cursor-pointer"
>{{ title }}
</NuxtLink>
</h2>
<p v-if="pageSubheading">{{ pageSubheading }}</p>
<p>
<time class="text-sm" :datetime="postDate">{{ postDate }}</time>
</p>
<article class="py-6 mb-12">
<figure
v-if="entry.image && entry.image.length > 0"
:class="featured ? '' : 'sm:w-1/3'"
>
<NuxtLink
:to="`/${entry.uri}`"
class="text-red-600 hover:underline focus:underline cursor-pointer block mb-4"
>
<img
:src="entry.image[0].url"
:alt="entry.image[0].alt"
width="990"
height="540"
/>
</NuxtLink>
</figure>
<div class="mb-4"å>
<h2 class="font-bold mb-2" :class="featured ? 'text-6xl' : 'text-4xl'">
<NuxtLink
:to="`/${entry.uri}`"
class="text-red-600 hover:underline focus:underline cursor-pointer"
>
{{ entry.title }}
</NuxtLink>
</h2>
<p v-if="entry.pageSubheading">{{ entry.pageSubheading }}</p>
<p>
<time class="text-sm" :datetime="entry.postDate">{{ entry.postDate }}</time>
</p>
</div>
</article>
</template>
2 changes: 1 addition & 1 deletion frontend/pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ useHead(() => ({
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">
{{ pageData.title }}
</h1>
<p v-if="pageData.pageSubheading">
<p v-if="pageData.pageSubheading" class="mt-4">
{{ pageData.pageSubheading }}
</p>
</header>
Expand Down
44 changes: 21 additions & 23 deletions frontend/pages/blog/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useHead } from '#imports'
const route = useRoute()
const graphql = useGraphQL()
const { isPreview, previewToken, previewTimestamp } = usePreview()
const hero = computed(() => currentPost.value?.image && currentPost.value?.image.length > 0)
// Disable SSR for preview mode
if (isPreview.value) {
Expand Down Expand Up @@ -81,30 +82,35 @@ useHead(() => ({
</div>
<template v-else-if="hasPost">
<header class="container mx-auto pt-12 pb-6 px-2 text-2xl">
<figure v-if="currentPost.image">
<img :src="currentPost.image.url" :alt="currentPost.image.description" />
<header class="container mx-auto pt-12 pb-6 px-2 text-2xl relative" :class="hero ? 'aspect-video' : ''">
<figure v-if="hero" class="absolute top-0 left-0 w-full h-full">
<img :src="currentPost.image[0].url" :alt="currentPost.image[0].alt" />
</figure>
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">{{ currentPost.title }}</h1>
<p v-if="currentPost.pageSubheading">{{ currentPost.pageSubheading }}</p>
<div class="text-xs mt-4">
<p>
<span v-if="currentPost.category?.length" class="font-bold">
{{ currentPost.category[0].title }}
</span>
<div class=" z-10" :class="hero ? 'text-white bg-black/80 p-4 sm:bottom-0 relative sm:ml-4 sm:max-w-screen-lg sm:absolute sm:rounded' : ''">
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">{{ currentPost.title }}</h1>
<p v-if="currentPost.pageSubheading" class="mt-4">{{ currentPost.pageSubheading }}</p>
<div class="text-xs mt-4">
<p>
<span v-if="currentPost.category?.length" class="font-bold">
{{ currentPost.category[0].title }}
</span>
<template v-if="currentPost.category?.length && currentPost.postDate">
|
</template>
<time v-if="currentPost.postDate" :datetime="currentPost.postDate">
{{ currentPost.postDate }}
</time>
</p>
</time>
</p>
</div>
</div>
</header>
<section class="page__content">
<div
class="container mx-auto py-12 px-2 text-balance"
class="container mx-auto py-12 px-2 text-balance prose"
v-html="currentPost.pageContent"
></div>
</section>
Expand All @@ -113,20 +119,12 @@ useHead(() => ({
<Teaser
v-if="currentPost.prev"
:key="currentPost.prev.id"
:id="currentPost.prev.id"
:title="currentPost.prev.title"
:uri="currentPost.prev.uri"
:pageSubheading="currentPost.prev.pageSubheading"
:postDate="currentPost.prev.postDate"
:entry="currentPost.prev"
/>
<Teaser
v-if="currentPost.next"
:key="currentPost.next.id"
:id="currentPost.next.id"
:title="currentPost.next.title"
:uri="currentPost.next.uri"
:pageSubheading="currentPost.next.pageSubheading"
:postDate="currentPost.next.postDate"
:entry="currentPost.next"
/>
</section>
</template>
Expand Down
11 changes: 4 additions & 7 deletions frontend/pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,17 @@ useHead(() => ({
<div v-else>
<header class="container mx-auto pt-12 pb-6 px-2 text-2xl">
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">{{ content.title }}</h1>
<p v-if="content.pageSubheading">{{ content.pageSubheading }}</p>
<p v-if="content.pageSubheading" class="mt-4">{{ content.pageSubheading }}</p>
</header>
<section class="page__content">
<div class="container mx-auto py-12 px-2 text-balance" v-html="content.pageContent"></div>
</section>
<section class="container mx-auto mb-6 px-2 divide-y divide-slate-300">
<Teaser
v-for="entry in posts"
v-for="(entry, index) in posts"
:featured="index === 0 ? true : false"
:key="entry.id"
:id="entry.id"
:title="entry.title"
:uri="entry.uri"
:pageSubheading="entry.pageSubheading"
:postDate="entry.postDate"
:entry="entry"
/>
<Pagination
v-if="totalPages > 1"
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/guestbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ useHead(() => ({
<template v-else>
<header class="container mx-auto pt-12 pb-6 px-2 text-2xl">
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">{{ content.title }}</h1>
<p v-if="content.pageSubheading">{{ content.pageSubheading }}</p>
<p v-if="content.pageSubheading" class="mt-4">{{ content.pageSubheading }}</p>
</header>
<section class="page__content">
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ watch([isPreview, previewToken], () => {
<h1 class="font-bold text-4xl sm:text-6xl lg:text-9xl">
{{ data?.entries?.[0]?.title }}
</h1>
<p v-if="data?.entries?.[0]?.pageSubheading">
<p v-if="data?.entries?.[0]?.pageSubheading" class="mt-4">
{{ data?.entries?.[0]?.pageSubheading }}
</p>
</header>
Expand Down
4 changes: 4 additions & 0 deletions frontend/queries/blog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const BLOG_QUERY = `
pageSubheading
pageContent
postDate @formatDateTime(format: "F j, Y")
image {
alt
url @transform(handle: "wide")
}
}
}
entryCount(section: "blogPosts")
Expand Down
8 changes: 6 additions & 2 deletions frontend/queries/blogPosts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ export const BLOG_POSTS_QUERY = `
pageSubheading
pageContent
postDate @formatDateTime(format: "F j, Y")
next(section: "article") {
image {
alt
url @transform(handle: "hero")
}
next(section: "blogPosts") {
id
slug
uri
title
postDate @formatDateTime(format: "F j, Y")
}
prev(section: "article") {
prev(section: "blogPosts") {
id
slug
uri
Expand Down

0 comments on commit 2df119e

Please sign in to comment.