Skip to content

Commit

Permalink
feat: more work on posts
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Oct 31, 2023
1 parent 234d3e4 commit 8d25093
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .vitepress/theme/posts.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default createContentLoader('pages/posts/*.md', {

return {
title: frontmatter.title,
excerpt: truncateText(frontmatter.description, 100),
excerpt: truncateText(frontmatter.description, 150),
image: getImagePath(url),
author: frontmatter.author || 'PDan',
href: url,
Expand Down
6 changes: 6 additions & 0 deletions .vitepress/theme/style.sass
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
--vp-home-hero-name-color: transparent
--vp-home-hero-name-background: -webkit-linear-gradient(110deg, var(--vp-c-brand-1) 10%, var(--vp-c-brand-3) 30%, var(--vp-c-brand-2))

html
scrollbar-gutter: stable

body
contain: layout

.VPHero
.name
font-weight: 800
31 changes: 20 additions & 11 deletions components/PostCard.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<a class="card" :href="href">
<component :is="href ? 'a' : 'section'" class="card" :href="href">
<script-tag :meta="meta" />

<article>
<article :class="{ active: href }">
<img
v-if="imageSrc"
class="thumbnail"
Expand All @@ -26,14 +26,14 @@
by
<address v-text="author" />
</div>
<div v-if="date.iso">
<div v-if="date && date.iso">
<time pubdate :datetime="date.iso" v-text="date.pretty" />
</div>
</div>
</section>
</div>
</article>
</a>
</component>
</template>

<script>
Expand Down Expand Up @@ -85,13 +85,13 @@ export default {
'@context': 'https://schema.org/',
'@type': 'Article',
headline: this.title,
description: this.date.excerpt,
description: this.excerpt,
thumbnailUrl: this.image,
author: {
'@type': 'Person',
name: this.author,
},
datePublished: this.date.iso,
datePublished: this.date ? this.date.iso : null,
});
},
Expand Down Expand Up @@ -125,7 +125,7 @@ article
box-shadow: var(--vp-shadow-1)
transition: box-shadow 0.25s, background-color 0.25s
&:hover
&.active:hover
background-color: var(--vp-c-bg-elv)
box-shadow: var(--vp-shadow-2)
Expand Down Expand Up @@ -161,11 +161,20 @@ article
.content
flex-grow: 1
padding-inline: 8px
h2
color: var(--vp-c-brand)
font-size: 1.2em
font-weight: bold
h2
color: var(--vp-c-brand)
font-size: 1.2em
font-weight: bold
margin: 8px 0 16px 0
padding: 0
border: none
letter-spacing: -0.02em
p
margin-block: 2px
.info
display: flex
Expand Down
23 changes: 23 additions & 0 deletions components/PostHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup>
import { computed } from 'vue';
import { useData, withBase } from 'vitepress';
import { data } from 'theme/posts.data.js';
import PostCard from 'components/PostCard.vue';
const { posts } = data;
const { page } = useData();
const postCardData = computed(() => {
if (!page.value) {
return null;
}
const needle = `/${ withBase(page.value.relativePath.split('.').slice(0, -1).join('.')) }.html`;
const post = posts.find((p) => p.href === needle);
return post ? { ...post, href: null } : post;
});
</script>

<template>
<PostCard v-if="postCardData" v-bind="postCardData" />
</template>
2 changes: 1 addition & 1 deletion components/PostsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<style lang="sass" scoped>
.container
padding: 1rem
max-width: 60rem
max-width: 1104px
margin-inline: auto
.tags
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"dependencies": {
"@vueuse/core": "^10.5.0",
"quasar": "^2.13.0",
"vue": "^3.3.7"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions pages/about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: About
description: Contact information
---

# About PDan

## Contact

* Name: Dan Popescu (PDan)
Expand Down
35 changes: 0 additions & 35 deletions pages/api-examples/index.md

This file was deleted.

85 changes: 0 additions & 85 deletions pages/markdown-examples/index.md

This file was deleted.

2 changes: 2 additions & 0 deletions pages/my-projects/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: A list of projects I created or I worked on
outline: [2, 3]
---

# My Projects

## Quasar v1 (Vue 2)

Quasar is a Vue based components framework that also provide an easy way to build cross-target applications (web, mobile - cordova/capacitor, desktop - electron).
Expand Down
20 changes: 14 additions & 6 deletions pages/posts/post_001.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
---
title: First post
description: First post in a list of more posts. I hope.
date: 2023-10-30
tags: [test]
title: Grouping form elements in Quasar
description: Explain styling needed to group form elements in Quasar in order to make them look like a single element.
date: 2023-10-31
tags: [quasar, css]
---

# First post
{{ title }}
<script setup>
import PostHeader from 'components/PostHeader.vue';
</script>

<PostHeader />

## Problem description

<demo-block src="./post_001_01.demo.vue" />


Post 1 content.

Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d25093

Please sign in to comment.