Skip to content

Commit e59f9fd

Browse files
authored
Merge pull request #26 from data-miner00/dev
Improvements and fixes
2 parents 4b0e535 + 5b2608c commit e59f9fd

File tree

18 files changed

+181
-21
lines changed

18 files changed

+181
-21
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ List of resources that are helpful and would like to give credit to.
192192
- [Vue i18n](https://vue-i18n.intlify.dev/)
193193
- [Nuxt Seo Kit](https://github.com/harlan-zw/nuxt-seo-kit)
194194
- [Nuxt Image](https://image.nuxtjs.org/)
195+
- [Nuxt UI](https://ui.nuxt.com/)
195196

196197
<p align="right">(<a href="#readme-top">back to top</a>)</p>
197198

_typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[files]
2+
extend-exclude = ["locales/fr.json", "content/fr/**/*.md"]

components/FeatureCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineComponent({
1414

1515
<template>
1616
<section
17-
class="border overflow-hidden border-solid relative border-gray-200 rounded-xl shadow-lg shadow-gray-200 dark:border-gray-700 dark:shadow-none after:h-6 after:w-12 dark:after:bg-gray-700 after:bg-gray-100 after:absolute after:-top-1 after:-right-4 after:transform after:rotate-45"
17+
class="border overflow-hidden border-solid relative border-gray-200 rounded-xl shadow-lg shadow-gray-200 dark:border-gray-700 dark:shadow-none after:h-6 after:w-12 dark:after:bg-gray-700 after:bg-gray-100 after:absolute after:-top-1 after:-right-4 after:transform after:rotate-45 h-full"
1818
>
1919
<header
2020
class="flex items-center border-b border-solid border-gray-200 dark:border-gray-700 p-5"

components/VLinkChildren.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script setup lang="ts">
2+
import type { NavItem } from "@nuxt/content/dist/runtime/types";
3+
4+
type Props = {
5+
topics: NavItem[] | undefined;
6+
};
7+
8+
defineProps<Props>();
9+
</script>
10+
11+
<template>
12+
<div :key="topic._id" v-for="(topic, index) in topics" class="pl-4">
13+
<NuxtLink :to="topic._path">
14+
<span v-if="topics && index < topics?.length - 1">├</span
15+
><span v-else>└</span> <span v-if="topic.children">📁</span
16+
><span v-else>📃</span>
17+
{{ topic.title }}
18+
</NuxtLink>
19+
<VLinkChildren :topics="topic.children" />
20+
</div>
21+
</template>

components/content/ApaReference.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type Props = {
44
authors?: string[];
55
organization?: string;
66
title: string;
7-
date: string;
7+
date?: string;
88
retrievedDate?: string;
99
publisher?: string;
1010
url: string;
@@ -38,13 +38,16 @@ const hasAuthor = computed(() => props.authors || props.organization);
3838
<template>
3939
<div class="pl-8 md:pl-16 -indent-8 md:-indent-16 mb-4 last-of-type:mb-0">
4040
<span v-if="hasAuthor">{{ authorsString }}. </span>
41-
<time v-if="hasAuthor" :datetime="date">({{ date }}). </time>
41+
<time v-if="hasAuthor" :datetime="date">({{ date ?? "n.d." }}). </time>
4242
<span :class="italicTitle ? 'italic' : ''">
43-
{{ punctuatedTitle }}&nbsp;
43+
{{ punctuatedTitle }}
4444
</span>
45-
<time v-if="!hasAuthor" :datetime="date">({{ date }}). </time>
46-
<span v-if="publisher" :class="!italicTitle ? 'italic' : ''">
47-
{{ publisher }}.
45+
<time v-if="!hasAuthor" :datetime="date">({{ date ?? "n.d." }}). </time>
46+
<span v-if="publisher" :class="!italicTitle ? 'italic' : ''"
47+
>&nbsp;{{ publisher }}.
48+
</span>
49+
<span v-if="!date && source === 'websites'">
50+
Retrieved {{ retrievedDate }} from
4851
</span>
4952
<a :href="url">{{ url }}</a>
5053
</div>

components/content/ProseImg.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<script setup lang="ts">
2+
type Props = {
3+
src: string;
4+
alt: string;
5+
width?: string | number;
6+
height?: string | number;
7+
};
8+
9+
defineProps<Props>();
10+
</script>
11+
12+
<template>
13+
<div
14+
class="img-container w-full rounded-lg border border-solid border-gray-200 dark:border-gray-600 my-5 inline-block"
15+
>
16+
<NuxtImg
17+
:src="src"
18+
:alt="alt"
19+
class="block mx-auto"
20+
:width="width"
21+
:height="height"
22+
>
23+
</NuxtImg>
24+
</div>
25+
</template>
26+
27+
<style>
28+
.img-container {
29+
--pattern-base-color: white;
30+
--pattern-box-color: #f6f7f8;
31+
background-size: 40px 40px;
32+
background-image: linear-gradient(
33+
to right,
34+
var(--pattern-box-color) 1px,
35+
transparent 1px
36+
),
37+
linear-gradient(to bottom, var(--pattern-box-color) 1px, transparent 1px);
38+
background-color: var(--pattern-base-color);
39+
opacity: 0.95;
40+
background-position: center;
41+
}
42+
43+
.dark .img-container {
44+
--pattern-base-color: rgb(55 65 81);
45+
--pattern-box-color: rgb(47, 61, 80);
46+
}
47+
</style>

content/blogs/2.my-second-blog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ Finally, after a whole minute later, I finally saw the bus bellowing down the ro
3030

3131
The moment when the bus stopped in front of me, I was flabbergasted and stunned. I couldn't feel my breath anymore and starts to comtemplate about my mixed feelings towards the arrival of the bus.
3232

33-
After regaining my conciousness, I realised that the bus and the fellow peasants has long been gone. "Can like that one meh," I chided.
33+
After regaining my consciousness, I realised that the bus and the fellow peasants has long been gone. "Can like that one meh," I chided.

content/blogs/_dir.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title: "My Blogs"
2+
navigation.description: "Read some of my blogs"

content/demo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tags:
1111
- reactive
1212
- rxjs
1313
- cheatsheet
14-
updatedAt: 2022-11-18T11:37:49.432Z
14+
updatedAt: 2024-03-28T11:05:53.157Z
1515
createdAt: 2022-11-18T11:37:49.432Z
1616
---
1717

@@ -44,7 +44,7 @@ If you are using [Webpack](https://webpack.js.org/) or other JavaScript bundler,
4444

4545
## Angular
4646

47-
[Angular](https://angular.io/) is a JavaScript Framework developed by Google. RxJS can be used on the get-go as it is baked into Angular by default so there is no need for a seperate installation. All we need is just the [Angular CLI](https://angular.io/cli) to create a new project to work with.
47+
[Angular](https://angular.io/) is a JavaScript Framework developed by Google. RxJS can be used on the get-go as it is baked into Angular by default so there is no need for a separate installation. All we need is just the [Angular CLI](https://angular.io/cli) to create a new project to work with.
4848

4949
```
5050
ng new <your-project-name>
@@ -125,7 +125,7 @@ const event$ = fromEvent(document, "click");
125125
event$.subscribe((x) => console.log(x));
126126
```
127127

128-
Another observer creation method is `interval`, where it takes in the time inteval in miliseconds and perpetually emits an increment of integer by 1 starting from 0.
128+
Another observer creation method is `interval`, where it takes in the time interval in milliseconds and perpetually emits an increment of integer by 1 starting from 0.
129129

130130
```ts
131131
const periodic$ = interval(1000);

content/fr/_dir.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title: "la maison"
2+
navigation.description: "Bienvenue chez moi"

content/fr/blogs/_dir.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title: "mes blogs"
2+
navigation.description: "Lisez certains de mes blogs"

content/fr/guide.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ content/
152152

153153
![ma belle image](/images/demo.png)
154154

155-
Voici à quoi ressemble une image de portrait dans la prose. Il est aligné à gauche et s'étendra jusqu'à la largeur maximale disponible dans la prose. Les images qui seront diffusées avec l'application peuvent être placées dans le répertoire "public". Par exemple, les images du dossier `/public/images` sont accessibles via le chemin `/images/img.jpg` directement.
155+
Voici à quoi ressemble une image de portrait dans la prose. Il est centré dans un conteneur personnalisé via le fichier `ProseImg.vue` personnalisé dans le dossier `components/content` et s'étendra jusqu'à la largeur maximale disponible dans le conteneur. Les images qui seront servies avec l'application peuvent être placées dans le répertoire `public`. Par exemple, les images du dossier `/public/images` sont accessibles directement via le chemin `/images/img.jpg`.
156156

157157
```md
158158
![ma belle image](/images/demo.png)
@@ -170,6 +170,20 @@ Pour les images situées dans le dossier `/assets/images`, elles devront être t
170170
</template>
171171
```
172172

173+
### Tableau
174+
175+
Voici à quoi ressemble le tableau par défaut.
176+
177+
| Âge | Personne 1 | Personne 2 | Personne 3 | Moyenne |
178+
| --- | --- | --- | --- | --- |
179+
| 8 | 6 | 7 | 5 | 6 |
180+
| 10 | 6.5 | 7.5 | 8.5 | 7.5 |
181+
| 12 | 8 | 9 | 10 | 9 |
182+
183+
### Clavier
184+
185+
Les touches du clavier peuvent être représentées par la balise HTML `<kbd>` telle que <kbd>Esc</kbd>, <kbd>Entrée</kbd> et <kbd>Ctrl</kbd>.
186+
173187
### Prise en charge de LaTeX
174188

175189
Ce modèle est également livré avec le support de $\LaTeX$. Écrivez facilement de belles équations dans le Markdown !
@@ -474,7 +488,7 @@ Cela garantira que lorsque vous êtes dans le contexte anglais, le lien vous red
474488

475489
## Références de style APA
476490

477-
De plus, ce modèle est également livré avec un simple composant de citation de style APA qui peut être utilisé dans le fichier Markdown à l'aide de la syntaxe MDC. Les exemples et les styles sont conçus sur la base de cet [article Scribbr](https://www.scribbr.com/apa-examples/website/)
491+
De plus, ce modèle est également livré avec un simple composant de citation de style APA qui peut être utilisé dans le fichier Markdown à l'aide de la syntaxe MDC. Les exemples et les styles sont conçus sur la base de cet [article Scribbr](https://www.scribbr.com/apa-examples/website/).
478492

479493
```
480494
::apa-reference

content/guide.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors:
99
tags:
1010
- tutorial
1111
- guide
12-
updatedAt: 2023-11-18T11:37:49.432Z
12+
updatedAt: 2024-03-28T11:05:53.157Z
1313
createdAt: 2023-11-18T11:37:49.432Z
1414
---
1515

@@ -150,7 +150,7 @@ content/
150150

151151
![my cool image](/images/demo.png)
152152

153-
This is how a potrait image looks like within the prose. It is left aligned and will extend to the max width available in the prose. Images that will be served alongside with the app can be placed within the `public` directory. For instance, images within the `/public/images` folder can be accessed via the path `/images/img.jpg` directly.
153+
This is how a portrait image looks like within the prose. It is centered within a custom container via the custom `ProseImg.vue` in the `components/content` folder and will extend to the max width available in the container. Images that will be served alongside with the app can be placed within the `public` directory. For instance, images within the `/public/images` folder can be accessed via the path `/images/img.jpg` directly.
154154

155155
```md
156156
![my cool image](/images/demo.png)
@@ -168,6 +168,20 @@ For images that are located in `/assets/images` folder, they will need to be pro
168168
</template>
169169
```
170170

171+
### Tables
172+
173+
This is how the default table looks like.
174+
175+
| Age | Person 1 | Person 2 | Person 3 | Average |
176+
| --- | --- | --- | --- | --- |
177+
| 8 | 6 | 7 | 5 | 6 |
178+
| 10 | 6.5 | 7.5 | 8.5 | 7.5 |
179+
| 12 | 8 | 9 | 10 | 9 |
180+
181+
### Keyboard
182+
183+
Keyboard keys can be represented with the `<kbd>` HTML tag such as <kbd>Esc</kbd>, <kbd>Enter</kbd> and <kbd>Ctrl</kbd>.
184+
171185
### LaTeX Support
172186

173187
This template also comes with the support for $\LaTeX$. Write beautiful equations within the Markdown with ease!
@@ -359,7 +373,7 @@ The url of the non-default locale will be prefixed with it's code whereas the de
359373

360374
### Defining Words
361375

362-
To define a word for the intended languages, there is a section in `nuxt.config.ts` named `vueI18n` within the `i18n` object to define them. For instance, to define the world "welcome" for both English and French, create a property called `welcome` within thier respective locales object inside `messages` with their corresponding value will do.
376+
To define a word for the intended languages, there is a section in `nuxt.config.ts` named `vueI18n` within the `i18n` object to define them. For instance, to define the world "welcome" for both English and French, create a property called `welcome` within their respective locales object inside `messages` with their corresponding value will do.
363377

364378
```ts [nuxt.config.ts]
365379
export default defineNuxtConfig({
@@ -392,7 +406,7 @@ With this in place, Nuxt is smart enough to render out "Welcome" or "Bienvenue"
392406

393407
While the above solution of adding new definition of words in the `nuxt.config.ts` file works, it can pose a real problem when the **vocabulary grows** as the file become cumbersome to maintain.
394408

395-
Fortunately, there is another preferred way to store the language definitions in their own, seperate JSON file. With this approach, not only it achieves the Single Responsibility Principle, it also drastically improve the maintainability of the files.
409+
Fortunately, there is another preferred way to store the language definitions in their own, separate JSON file. With this approach, not only it achieves the Single Responsibility Principle, it also drastically improve the maintainability of the files.
396410

397411
Here is how it is configured in `nuxt.config.ts`.
398412

@@ -418,7 +432,7 @@ The above code tells Nuxt to locate English definition in `en.json` file and Fre
418432

419433
### I18n in Nuxt Content
420434

421-
To support internationalization for Markdown based contents from Nuxt Content, create a corresponsing folder inside the `content` folder with the non-default locale's code and imitate the structure of the base folder.
435+
To support internationalization for Markdown based contents from Nuxt Content, create a corresponding folder inside the `content` folder with the non-default locale's code and imitate the structure of the base folder.
422436

423437
For example, given I have the following file structure that has English contents, the French contents can be housed in the following manner.
424438

locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"title": "Dark mode",
2020
"description": "Enrich user experience with dark and light mode whichever that suits their appetite."
2121
}
22+
},
23+
"sitemap": {
24+
"sitemap": "Sitemap",
25+
"heading": "Full List of Articles, on this Website.",
26+
"description_html": "This section lists down every single Markdown entry in the <span class=\"bg-gray-100 dark:bg-gray-700 px-2 rounded py-1\">contents</span> folder."
2227
}
2328
},
2429
"header": {

locales/fr.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"title": "Mode sombre",
2020
"description": "Enrichissez l'expérience utilisateur avec le mode sombre et clair selon ce qui convient à leur appétit."
2121
}
22+
},
23+
"sitemap": {
24+
"sitemap": "Plan du site",
25+
"heading": "Liste complète des articles, sur ce site Web.",
26+
"description_html": "Cette section répertorie chaque entrée Markdown dans le dossier <span class=\"bg-gray-100 dark:bg-gray-700 px-2 rounded py-1\">contents</span>."
2227
}
2328
},
2429
"header": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": "Shaun Chong <[email protected]>",
55
"license": "MIT",
66
"private": true,
7-
"version": "1.1.0",
7+
"version": "1.2.0",
88
"scripts": {
99
"build": "nuxt build",
1010
"dev": "nuxt dev",

pages/[...slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ onBeforeUnmount(() => {
8787
class="mx-auto flex flex-col-reverse lg:flex-row justify-center px-6 lg:px-0"
8888
>
8989
<article
90-
class="prose prose-stone dark:prose-invert sm:max-w-[65ch] prose-pre:bg-gray-100 dark:prose-pre:bg-slate-700 dark:prose-pre:text-gray-50 prose-pre:border prose-pre:border-gray-200 dark:prose-pre:border-gray-700 prose-pre:border-solid prose-pre:rounded-lg prose-pre:text-slate-800 prose-headings:text-cyan-600 dark:prose-hr:border-gray-700 dark:prose-li:marker:text-gray-200 dark:prose-blockquote:border-gray-200 prose-headings:scroll-mt-24"
90+
class="prose prose-stone dark:prose-invert sm:max-w-[65ch] prose-pre:bg-gray-100 dark:prose-pre:bg-slate-700 dark:prose-pre:text-gray-50 prose-pre:border prose-pre:border-gray-200 dark:prose-pre:border-gray-700 prose-pre:border-solid prose-pre:rounded-lg prose-pre:text-slate-800 prose-headings:text-cyan-600 dark:prose-hr:border-gray-700 dark:prose-li:marker:text-gray-200 dark:prose-blockquote:border-gray-200 prose-headings:scroll-mt-24 dark:prose-tr:border-gray-500 dark:prose-thead:border-gray-400"
9191
>
9292
<ContentRenderer :value="(data as Record<string, any> | undefined)">
9393
<template #empty>

pages/index.vue

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<script lang="ts" setup>
22
const localePath = useLocalePath();
3+
const { data: navigation } = await useAsyncData("navigation", () =>
4+
fetchContentNavigation()
5+
);
36
</script>
47

58
<template>
@@ -34,7 +37,7 @@ const localePath = useLocalePath();
3437
</div>
3538
</div>
3639
</Landing>
37-
<section class="lg:max-w-[75rem] mx-auto px-6 pb-10">
40+
<section class="lg:max-w-[75rem] mx-auto px-6 pb-10 lg:mb-32">
3841
<ul
3942
class="grid grid-cols-1 grid-rows-3 lg:grid-cols-3 lg:grid-rows-1 gap-5"
4043
>
@@ -88,4 +91,43 @@ const localePath = useLocalePath();
8891
</li>
8992
</ul>
9093
</section>
94+
<section class="lg:max-w-[75rem] mx-auto px-6 pb-10 my-12 lg:my-[100px]">
95+
<p class="text-lg text-sky-600 font-bold lg:mb-2">
96+
{{ $t("homePage.sitemap.sitemap") }}
97+
</p>
98+
<h2 class="text-2xl lg:text-4xl font-bold mb-4">
99+
{{ $t("homePage.sitemap.heading") }}
100+
</h2>
101+
<p
102+
class="text-lg mb-8"
103+
v-html="$t('homePage.sitemap.description_html')"
104+
></p>
105+
<main
106+
class="p-10 border border-solid border-gray-200 dark:border-gray-600 rounded-lg"
107+
>
108+
~/
109+
<VLinkChildren :topics="navigation ? navigation : undefined" />
110+
</main>
111+
</section>
91112
</template>
113+
114+
<style scoped>
115+
main {
116+
--mask-color: #eee;
117+
--background-color: #fafafa;
118+
background-color: var(--background-color);
119+
opacity: 0.8;
120+
background-image: linear-gradient(var(--mask-color) 1px, transparent 1px),
121+
linear-gradient(
122+
to right,
123+
var(--mask-color) 1px,
124+
var(--background-color) 1px
125+
);
126+
background-size: 20px 20px;
127+
}
128+
129+
.dark main {
130+
--mask-color: #3b3b3b;
131+
--background-color: #1e293b;
132+
}
133+
</style>

0 commit comments

Comments
 (0)