@4verburga/alpine-spanishplus 1.6.6 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -58
- package/components/content/ArticlesList.vue +84 -16
- package/layouts/article.vue +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,60 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
run pnpm pack to build the compiled theme
|
|
2
2
|
|
|
3
|
-
# Alpine
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
8
|
-
[![Nuxt][nuxt-src]][nuxt-href]
|
|
9
|
-
[![Nuxt Studio][nuxt-studio-src]][nuxt-studio-href]
|
|
10
|
-
[![Volta][volta-src]][volta-href]
|
|
11
|
-
|
|
12
|
-
The minimalist blog theme, powered by [Nuxt](https://nuxt.com).
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- [📸 Online demo](https://alpine.nuxt.space)
|
|
16
|
-
- [⚡️ Play on StackBlitz](https://stackblitz.com/github/nuxt-themes/alpine-starter)
|
|
17
|
-
|
|
18
|
-
## Features
|
|
19
|
-
|
|
20
|
-
- Start from a **profile page**, scale to a **complete blog**!
|
|
21
|
-
- An [open source blog theme](https://github.com/nuxt-themes/alpine) powered by [Nuxt Content](https://content.nuxtjs.org), editable from [Nuxt Studio](https://nuxt.studio).
|
|
22
|
-
- Write pages in Markdown and Vue components with the [MDC syntax](https://content.nuxtjs.org/guide/writing/mdc).
|
|
23
|
-
- Use [**30+ built-in**](https://elements.nuxt.space) components in your Markdown pages.
|
|
24
|
-
|
|
25
|
-
## Quick Start
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx nuxi@latest init -t themes/alpine
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Contributing 🙏
|
|
32
|
-
|
|
33
|
-
1. Clone this repository
|
|
34
|
-
2. Install dependencies using `pnpm install`
|
|
35
|
-
3. Run `pnpm prepare` to generate type stubs.
|
|
36
|
-
4. Use `pnpm dev` to start [playground](./playground) in development mode.
|
|
37
|
-
|
|
38
|
-
## License
|
|
39
|
-
|
|
40
|
-
[MIT](./LICENSE)
|
|
41
|
-
|
|
42
|
-
<!-- Badges -->
|
|
43
|
-
[npm-version-src]: https://img.shields.io/npm/v/@nuxt-themes/alpine/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
44
|
-
[npm-version-href]: https://npmjs.com/package/@nuxt-themes/alpine
|
|
45
|
-
|
|
46
|
-
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxt-themes/alpine.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
47
|
-
[npm-downloads-href]: https://npmjs.com/package/@nuxt-themes/alpine
|
|
48
|
-
|
|
49
|
-
[license-src]: https://img.shields.io/github/license/nuxt-themes/alpine.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
50
|
-
[license-href]: https://github.com/nuxt-themes/alpine/blob/main/LICENSE
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?&logo=nuxt.js
|
|
54
|
-
[nuxt-href]: https://nuxt.com
|
|
55
|
-
|
|
56
|
-
[nuxt-studio-src]: https://img.shields.io/badge/Open%20in%20Nuxt%20Studio-18181B?&logo=nuxt.js&logoColor=3BB5EC
|
|
57
|
-
[nuxt-studio-href]: https://nuxt.studio/themes/alpine
|
|
58
|
-
|
|
59
|
-
[volta-src]: https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg
|
|
60
|
-
[volta-href]: https://volta.net/nuxt-themes/alpine?utm_source=readme_alpine
|
|
4
|
+
TODO: find a way to recompute articles without using window.reload()
|
|
5
|
+
TODO: refactor the buttons using the button classes in footer or any other existing class.
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { withTrailingSlash } from 'ufo'
|
|
3
|
+
import { ref, computed, watch } from 'vue'
|
|
4
|
+
import { useRouter, useRoute } from 'vue-router'
|
|
5
|
+
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
const route = useRoute()
|
|
3
8
|
|
|
4
9
|
const props = defineProps({
|
|
5
10
|
path: {
|
|
@@ -8,28 +13,77 @@ const props = defineProps({
|
|
|
8
13
|
}
|
|
9
14
|
})
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
const
|
|
16
|
+
const currentYear = ref(parseInt(route.query.year as string) || new Date().getFullYear())
|
|
17
|
+
const years = ref([2025, 2024, 2023]) // Add more years as needed
|
|
18
|
+
|
|
19
|
+
const fetchArticles = async (year: number) => {
|
|
20
|
+
const path = `${props.path}/${year}`
|
|
21
|
+
const { data } = await useAsyncData(path, async () => await queryContent(withTrailingSlash(path)).sort({ date: -1 }).find())
|
|
22
|
+
return data
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const _articles = ref(await fetchArticles(currentYear.value))
|
|
13
26
|
|
|
14
27
|
const articles = computed(() => _articles.value || [])
|
|
28
|
+
|
|
29
|
+
const updateYear = async (year: number) => {
|
|
30
|
+
currentYear.value = year
|
|
31
|
+
await router.push({ query: { year: currentYear.value } })
|
|
32
|
+
window.location.reload()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const yearButtons = computed(() => {
|
|
36
|
+
const currentIndex = years.value.indexOf(currentYear.value)
|
|
37
|
+
const buttons = []
|
|
38
|
+
|
|
39
|
+
if (currentIndex > 1) {
|
|
40
|
+
buttons.push(years.value[0])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (currentIndex > 0) {
|
|
44
|
+
buttons.push(years.value[currentIndex - 1])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
buttons.push(currentYear.value)
|
|
48
|
+
|
|
49
|
+
if (currentIndex < years.value.length - 1) {
|
|
50
|
+
buttons.push(years.value[currentIndex + 1])
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (currentIndex < years.value.length - 2) {
|
|
54
|
+
buttons.push(years.value[years.value.length - 1])
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return buttons.reverse()
|
|
58
|
+
})
|
|
59
|
+
|
|
15
60
|
</script>
|
|
16
61
|
|
|
17
62
|
<template>
|
|
18
|
-
<div
|
|
19
|
-
<div class="
|
|
20
|
-
<
|
|
63
|
+
<div>
|
|
64
|
+
<div v-if="articles?.length" class="articles-list">
|
|
65
|
+
<div class="featured">
|
|
66
|
+
<ArticlesListItem :article="articles[0]" :featured="true" />
|
|
67
|
+
</div>
|
|
68
|
+
<div class="layout">
|
|
69
|
+
<ArticlesListItem v-for="(article, index) in articles.slice(1)" :key="index" :article="article" />
|
|
70
|
+
</div>
|
|
21
71
|
</div>
|
|
22
|
-
<div class="
|
|
23
|
-
<
|
|
72
|
+
<div v-else class="tour">
|
|
73
|
+
<p>Seems like there are no articles for {{ currentYear }}.</p>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="spacing"> </div>
|
|
76
|
+
<div class="navigation-buttons">
|
|
77
|
+
<button
|
|
78
|
+
v-for="year in yearButtons"
|
|
79
|
+
:key="year"
|
|
80
|
+
:disabled="year === currentYear"
|
|
81
|
+
@click="updateYear(year)"
|
|
82
|
+
class="nav-button"
|
|
83
|
+
>
|
|
84
|
+
{{ year }}
|
|
85
|
+
</button>
|
|
24
86
|
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<div v-else class="tour">
|
|
27
|
-
<p>Seems like there are no articles yet.</p>
|
|
28
|
-
<p>
|
|
29
|
-
You can start by
|
|
30
|
-
<!-- eslint-disable-next-line -->
|
|
31
|
-
<ProseA href="https://alpine.nuxt.space/articles/write-articles">creating</ProseA> one in the <ProseCodeInline>articles</ProseCodeInline> folder.
|
|
32
|
-
</p>
|
|
33
87
|
</div>
|
|
34
88
|
</template>
|
|
35
89
|
|
|
@@ -67,6 +121,20 @@ css({
|
|
|
67
121
|
flexDirection: 'column',
|
|
68
122
|
alignItems: 'center',
|
|
69
123
|
justifyContent: 'center',
|
|
124
|
+
},
|
|
125
|
+
'.navigation-buttons': {
|
|
126
|
+
display: 'flex',
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
marginTop: '20px',
|
|
129
|
+
button: {
|
|
130
|
+
padding: '10px 20px',
|
|
131
|
+
fontSize: '16px',
|
|
132
|
+
cursor: 'pointer',
|
|
133
|
+
'&:disabled': {
|
|
134
|
+
// cursor: 'not-allowed', not quite good looking
|
|
135
|
+
opacity: 0.5,
|
|
136
|
+
}
|
|
137
|
+
}
|
|
70
138
|
}
|
|
71
139
|
})
|
|
72
|
-
</style>
|
|
140
|
+
</style>
|
package/layouts/article.vue
CHANGED