Skip to content

Commit 17ae81e

Browse files
Revamp tutorial listing with images (#335)
* Show two articles per row * Extract card layout * Start laying out for images * Fix layout * Start implementing image generation * Add sharp * Serve the background for now * Add background for post images * Show background image for now * Make images larger * Start compositing images * Dynamically query for logos * Add logos * Grab the first logo * Add logos to articles * Dynamically show articles' first logo * Show "More" conditionally * Fix indentation problems, add image * Rename attribute * Start adding logos * Add all images for getting started * Add logos for projects tutorials * Add logos for tips and trips as well as migration tutorials * Add logos for migration, extensions and self hosting * Add logos for the rest of the tutorials * Resize image, move api endpoint * Move api folder back * Fix path error * Update paths * Fix paths * Move images * Revert "Move images" This reverts commit d264e79. * Revert "Revert "Move images"" This reverts commit 2afa132. * Fix path access * Revert "Revert "Revert "Move images""" This reverts commit 1028c39. * Use HTTP requests * Fix bug * Fix path * Fix import * Fix bugs * Fix logo alignment * Fix alignment issues * Update server/api/tutorialimg.ts
1 parent 18493a0 commit 17ae81e

File tree

139 files changed

+552
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+552
-28
lines changed

app/components/TutorialsArticles.vue

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,29 @@
22
const props = defineProps<{
33
path: string;
44
limit?: number;
5+
categoryTitle: string;
6+
showMore?: boolean;
57
}>();
68
79
const { data: articles } = await useAsyncData(props.path + '-preview', () => {
810
const query = queryContent(props.path)
911
.where({ _path: { $ne: props.path } })
10-
.only(['title', 'description', 'icon', '_path']);
12+
.only(['title', 'description', 'icon', '_path', 'technologies']);
1113
1214
if (props.limit) {
1315
query.limit(props.limit);
1416
}
1517
1618
return query.find();
1719
});
20+
21+
const moreImageSrc = '/docs/img/tutorials/more.png';
22+
23+
const imageSrc = (article: { technologies: string[] }) => {
24+
const technologies = article?.technologies || ['directus'];
25+
const techString = technologies.join(', ');
26+
return `/docs/api/tutorialimg?logos=${techString}`;
27+
};
1828
</script>
1929

2030
<template>
@@ -25,20 +35,50 @@ const { data: articles } = await useAsyncData(props.path + '-preview', () => {
2535
>
2636
<ShinyCard
2737
v-if="article.title"
28-
:title="article.title"
29-
:description="article.description"
3038
:to="article._path"
3139
:icon="article.icon"
32-
class="col-span-4"
40+
class="col-span-6"
3341
:ui="{
3442
body: {
3543
base: 'gap-0',
3644
},
3745
title: 'font-bold text-pretty',
3846
description: 'line-clamp-2',
3947
}"
40-
:color="cardColor(article.title)"
41-
/>
48+
:color="cardColor(article.title)">
49+
<div class="md:grid grid-cols-4 gap-4">
50+
<img class="col-span-2 mb-4 md:mb-0" :src="imageSrc(article)" alt="Generated Image"/>
51+
<div class="col-span-2">
52+
<ProseP class="text-gray-900 dark:text-white text-base truncate font-bold text-pretty">
53+
{{ article.title }}
54+
</ProseP>
55+
<ProseP class="text-[15px] text-gray-500 dark:text-gray-400 mt-1 line-clamp-2">
56+
{{ article.description }}
57+
</ProseP>
58+
</div>
59+
</div>
60+
</ShinyCard>
4261
</template>
62+
<ShinyCard
63+
v-if="showMore"
64+
:to="path"
65+
class="col-span-6"
66+
:ui="{
67+
body: {
68+
base: 'gap-0',
69+
},
70+
title: 'font-bold text-pretty',
71+
description: 'line-clamp-2',
72+
}"
73+
:color="cardColor(categoryTitle)">
74+
<div class="grid grid-cols-4 gap-4">
75+
<img class="col-span-2" :src="moreImageSrc" alt="More {{ categoryTitle }} tutorials"/>
76+
<div class="col-span-2 flex flex-col justify-center">
77+
<ProseP class="text-gray-900 dark:text-white text-base truncate font-bold text-pretty">
78+
See all {{ categoryTitle }} tutorials
79+
</ProseP>
80+
</div>
81+
</div>
82+
</ShinyCard>
4383
</ShinyGrid>
4484
</template>

app/components/TutorialsCategory.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@ defineProps<{
1919
<TutorialsArticles
2020
:limit="limit"
2121
:path="path"
22+
:category-title="title"
23+
:show-more="true"
2224
/>
23-
24-
<Callout
25-
class="w-6/12 my-10 font-bold"
26-
:to="path"
27-
icon="material-symbols:arrow-outward"
28-
>
29-
See all {{ title }} tutorials
30-
</Callout>
3125
</div>
3226
</template>

content/tutorials/1.getting-started/create-reusable-blocks-with-many-to-any-relationships.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: 9176d1b6-c530-44f3-92b3-71f35ae80902
33
slug: create-reusable-blocks-with-many-to-any-relationships
44
title: Create Reusable Blocks with Many-to-Any Relationships
5+
technologies:
6+
- db
57
authors:
68
- name: Bryant Gillespie
79
title: Growth Engineer

content/tutorials/1.getting-started/fetch-data-from-directus-in-android-with-kotlin.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: 3444d6c8-f336-4d0b-aa02-bc665f4ad3b5
33
slug: fetch-data-from-directus-in-android-with-kotlin
44
title: Fetch Data from Directus in Android with Kotlin
5+
technologies:
6+
- kotlin
57
authors:
68
- name: Ekekenta Clinton
79
title: Guest Author

content/tutorials/1.getting-started/fetch-data-from-directus-in-ios-with-swift.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: fbb96512-b46a-4a0c-bb39-b7d11ec0dc7f
33
slug: fetch-data-from-directus-in-ios-with-swift
44
title: Fetch Data from Directus in iOS with Swift
5+
technologies:
6+
- swift
57
authors:
68
- name: Harshpal Bhirth
79
title: Guest Author

content/tutorials/1.getting-started/fetch-data-from-directus-with-angular.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: 01d87344-02d8-45fc-a6e3-f13777cdab83
33
slug: fetch-data-from-directus-with-angular
44
title: Fetch Data from Directus with Angular
5+
technologies:
6+
- angular
57
authors:
68
- name: David Mbochi
79
title: Guest Author

content/tutorials/1.getting-started/fetch-data-from-directus-with-astro.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: 970eaaf3-d033-43d6-800e-c168e28c6d8f
33
slug: fetch-data-from-directus-with-astro
44
title: Fetch Data from Directus with Astro
5+
technologies:
6+
- astro
57
authors:
68
- name: Trust Jamin
79
title: Guest Author

content/tutorials/1.getting-started/fetch-data-from-directus-with-django.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: ab19694b-b7e5-44d1-994c-f7a5e5025829
33
slug: fetch-data-from-directus-with-django
44
title: Fetch Data from Directus with Django
5+
technologies:
6+
- django
57
authors:
68
- name: Omu Inetimi
79
title: Guest Author

content/tutorials/1.getting-started/fetch-data-from-directus-with-eleventy-3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
id: b847e493-5a35-49e1-80b1-3dc2657a0f7d
33
slug: fetch-data-from-directus-with-eleventy-3
4+
technologies:
5+
- 11ty
46
title: Fetch Data from Directus with Eleventy 3
57
authors:
68
- name: Kevin Lewis

content/tutorials/1.getting-started/fetch-data-from-directus-with-flask.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
id: c8562b3b-fbe0-4fd5-ade1-2d9a9e986f6d
33
slug: fetch-data-from-directus-with-flask
44
title: Fetch Data from Directus with Flask
5+
technologies:
6+
- flask
57
authors:
68
- name: Guilherme Souza
79
title: Guest Author

0 commit comments

Comments
 (0)