-
Notifications
You must be signed in to change notification settings - Fork 217
/
+page.svelte
133 lines (123 loc) · 5.36 KB
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<script lang="ts">
import { MainFooter } from '$lib/components';
import { DEFAULT_HOST } from '$lib/utils/metadata';
import { DOCS_TITLE_SUFFIX } from '$routes/titles';
const title = 'Tutorials' + DOCS_TITLE_SUFFIX;
const description =
'Follow a simple tutorial to get started with Appwrite in your preferred framework quickly and easily.';
const ogImage = DEFAULT_HOST + '/images/open-graph/docs.png';
export let data;
type MappedTutorial = (typeof data.tutorials)[number];
const iconMap: Record<string, string> = {
'react native': 'icon-react-native',
react: 'icon-react',
vue: 'web-icon-vue',
angular: 'icon-angular',
svelte: 'icon-svelte',
sveltekit: 'icon-svelte',
'sveltekit ssr': 'icon-svelte',
android: 'icon-android',
apple: 'icon-apple',
flutter: 'icon-flutter',
nuxt: 'icon-nuxt',
'nuxt ssr': 'icon-nuxt',
stripe: 'icon-stripe',
refine: 'web-icon-refine',
'next.js': 'icon-nextjs',
'next.js ssr': 'icon-nextjs',
astro: 'icon-astro',
'astro ssr': 'icon-astro'
};
const getIcon = (tutorial: MappedTutorial) => {
if (!tutorial.framework) return ''; // TODO: Default icon
return iconMap[tutorial.framework.toLowerCase()];
};
</script>
<svelte:head>
<!-- Titles -->
<title>{title}</title>
<meta property="og:title" content={title} />
<meta name="twitter:title" content={title} />
<!-- Description -->
<meta name="description" content={description} />
<meta property="og:description" content={description} />
<meta name="twitter:description" content={description} />
<!-- Image -->
<meta property="og:image" content={ogImage} />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta name="twitter:image" content={ogImage} />
<meta name="twitter:card" content="summary_large_image" />
</svelte:head>
<main class="web-main-section" id="main">
<article class="web-article">
<header class="web-article-header">
<div class="web-article-header-start web-u-cross-start flex flex-col">
<div class="relative flex items-center">
<h1 class="text-title font-aeonik-pro">Tutorials</h1>
</div>
</div>
<div class="web-article-header-end" />
</header>
<div class="web-article-content web-u-gap-80">
{#each data.tutorials as category}
<section class="flex flex-col gap-6">
<h2 class="text-micro uppercase">{category.title}</h2>
<ul class="web-grid-row-4 web-grid-row-4-mobile-1">
{#each category.tutorials as tutorial}
<li>
{#if tutorial.draft === true}
<a
href={tutorial.href}
class="web-card is-normal draft"
aria-disabled="true"
tabindex="-1"
>
<header class="flex items-baseline gap-1">
<span
class="{getIcon(tutorial)} web-u-font-size-24"
aria-hidden="true"
/>
<h3 class="text-sub-body text-primary font-medium">
{tutorial.framework}
</h3>
<span class="badge text-caption">Coming Soon</span>
</header>
</a>
{:else}
<a href={tutorial.href} class="web-card is-normal">
<header class="flex items-baseline gap-1">
<span
class="{getIcon(tutorial)} web-u-font-size-24"
aria-hidden="true"
/>
<h3 class="text-sub-body text-primary font-medium">
{tutorial.framework}
</h3>
</header>
<p class="text-sub-body mt-1">
{tutorial.title}
</p>
</a>
{/if}
</li>
{/each}
</ul>
</section>
{/each}
</div>
</article>
<MainFooter variant="docs" />
</main>
<style lang="scss">
.badge {
border-radius: 0.25rem;
background: rgba(253, 54, 110, 0.24);
padding: 0.0625rem 0.375rem;
margin-inline-start: 0.25rem;
}
.draft {
opacity: 0.4;
pointer-events: none;
}
</style>