Testing and debugging

This commit is contained in:
2021-04-19 22:20:46 +02:00
parent 97da8d1d0e
commit 4014ffd5d1
5 changed files with 31 additions and 30 deletions

View File

@@ -58,8 +58,7 @@ interface Project {
description: string, description: string,
url: string, url: string,
cover: string, cover: string,
color: string, tags: Array<Tag>,
skills: Array<Skill>
} }
export { Form, InfoData, Skill, Experience, Formation, Post, Tag, Project } export { Form, InfoData, Skill, Experience, Formation, Post, Tag, Project }

View File

@@ -2,7 +2,7 @@
<nuxt-link :to="`/blog/${slug}`" rel="noreferrer noopener"> <nuxt-link :to="`/blog/${slug}`" rel="noreferrer noopener">
<div class="rounded-lg shadow-xl h-116 w-full lg:w-100 text-left bg-gray-100 dark:bg-gray-800 transform hover:scale-103 duration-300 mb-8 lg:mb-0"> <div class="rounded-lg shadow-xl h-116 w-full lg:w-100 text-left bg-gray-100 dark:bg-gray-800 transform hover:scale-103 duration-300 mb-8 lg:mb-0">
<div class="h-2/5 post rounded-t-lg" <div class="h-2/5 post rounded-t-lg"
:style="{ backgroundImage: `url(${getBackgroundCover})` }"> :style="{ backgroundImage: `url(${getCover})` }">
</div> </div>
<div class="h-3/5 p-4 flex flex-col justify-between"> <div class="h-3/5 p-4 flex flex-col justify-between">
<div> <div>
@@ -26,7 +26,7 @@
<script lang="ts"> <script lang="ts">
import {computed, useContext} from "@nuxtjs/composition-api"; import {computed, useContext} from "@nuxtjs/composition-api";
interface PostHomeProps { interface PostProps {
title: string, title: string,
description: string, description: string,
date: string, date: string,
@@ -37,7 +37,7 @@ interface PostHomeProps {
} }
export default { export default {
name: "PostHome", name: "Post",
props: { props: {
title: { title: {
type: String, type: String,
@@ -68,8 +68,8 @@ export default {
default: 0 default: 0
} }
}, },
setup(props: PostHomeProps) { setup(props: PostProps) {
const getBackgroundCover = computed(() => require(`~/assets/images/posts/${props.cover}`)) const getCover = computed(() => require(`~/assets/images/posts/${props.cover}`))
const { i18n } = useContext() const { i18n } = useContext()
const formatDate = computed(() => { const formatDate = computed(() => {
@@ -78,7 +78,7 @@ export default {
}) })
return { return {
getBackgroundCover, getCover,
formatDate formatDate
} }
} }

View File

@@ -1,8 +1,8 @@
<template> <template>
<section class="w-full flex items-center justify-center my-20"> <section v-if="posts" class="w-full flex items-center justify-center my-20">
<div class="flex flex-col items-center text-center"> <div class="flex flex-col items-center text-center">
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<h2 class="font-bold text-3xl"> <h2 @click="debug" class="font-bold text-3xl">
{{ $t('blog.latest') }} {{ $t('blog.latest') }}
</h2> </h2>
<p class="text-gray-700 dark:text-gray-400 text-xl lg:w-2/3 mt-4"> <p class="text-gray-700 dark:text-gray-400 text-xl lg:w-2/3 mt-4">
@@ -10,7 +10,7 @@
</p> </p>
</div> </div>
<div class="my-8 lg:flex w-full lg:space-x-6"> <div class="my-8 lg:flex w-full lg:space-x-6">
<div v-if="posts" v-for="post in posts"> <div v-for="post in posts">
<Post <Post
:title="post.title" :title="post.title"
:cover="post.cover" :cover="post.cover"
@@ -34,24 +34,25 @@ import {useAsync, useContext} from "@nuxtjs/composition-api";
import {Post} from "../../@types/types"; import {Post} from "../../@types/types";
export default { export default {
name: "PostsPreview", name: "PostsHome",
setup() { setup() {
const { $content, i18n } = useContext() const { $content, i18n } = useContext()
const posts = useAsync(() => { const posts = useAsync(() => {
return $content(`articles/${i18n.locale}`) return $content(`articles/${i18n.locale}`)
.sortBy("date", "asc") .sortBy('date', 'asc')
.limit(3) .limit(3)
.fetch<Post>() .fetch<Post>()
}) })
return { const debug = () => {
posts console.log(posts)
} }
return {
posts,
debug
}
} }
} }
</script> </script>
<style scoped lang="scss">
</style>

View File

@@ -1,8 +1,8 @@
<template> <template>
<section class="w-full flex items-center justify-center my-20"> <section v-if="projects" class="w-full flex items-center justify-center my-20">
<div class="flex flex-col items-center text-center"> <div class="flex flex-col items-center text-center">
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<h2 class="font-bold text-3xl"> <h2 @click="debug" class="font-bold text-3xl">
{{ $t('projects.latest') }} {{ $t('projects.latest') }}
</h2> </h2>
<p class="text-gray-700 dark:text-gray-400 text-xl lg:w-2/3 mt-4"> <p class="text-gray-700 dark:text-gray-400 text-xl lg:w-2/3 mt-4">
@@ -10,7 +10,7 @@
</p> </p>
</div> </div>
<div class="my-8 lg:flex w-full lg:space-x-8"> <div class="my-8 lg:flex w-full lg:space-x-8">
<div v-if="projects" v-for="project in projects"> <div v-for="project in projects">
<Project <Project
:title="project.title" :title="project.title"
:cover="project.cover" :cover="project.cover"
@@ -32,7 +32,7 @@ import {useAsync, useContext} from "@nuxtjs/composition-api";
import {Project} from "../../@types/types"; import {Project} from "../../@types/types";
export default { export default {
name: "ProjectsPreview", name: "ProjectsHome",
setup() { setup() {
const { $content } = useContext() const { $content } = useContext()
@@ -42,13 +42,14 @@ export default {
.fetch<Project>() .fetch<Project>()
}) })
const debug = () => {
console.log(projects)
}
return { return {
projects projects,
debug
} }
} }
} }
</script> </script>
<style scoped lang="scss">
</style>

View File

@@ -12,7 +12,7 @@
<h1 class="text-gray-700 dark:text-gray-400 text-xl mt-4">{{ $t('projects.description') }}</h1> <h1 class="text-gray-700 dark:text-gray-400 text-xl mt-4">{{ $t('projects.description') }}</h1>
<div class="flex flex-col items-center md:items-start md:flex-row flex-wrap w-full space-y-3 md:space-y-0"> <div class="flex flex-col items-center md:items-start md:flex-row flex-wrap w-full space-y-3 md:space-y-0">
<div class="flex py-8 w-full flex-wrap" > <div class="flex py-8 w-full flex-wrap" >
<div class="md:mx-3 my-2 w-full xl:w-auto" v-for="project in projects"> <div class="md:mx-3 my-2 w-full lg:w-auto" v-for="project in projects">
<Project <Project
:title="project.title" :title="project.title"
:cover="project.cover" :cover="project.cover"