some stuff for smallpostpreview
This commit is contained in:
parent
370307c878
commit
99f91607d5
15 changed files with 1490 additions and 505 deletions
1794
package-lock.json
generated
1794
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -12,6 +12,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^6.0.8"
|
"@astrojs/preact": "^5.0.2",
|
||||||
|
"@astrojs/rss": "^4.0.17",
|
||||||
|
"astro": "^6.4.6",
|
||||||
|
"preact": "^10.29.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
61
src/components/PostPreviewSmall.astro
Normal file
61
src/components/PostPreviewSmall.astro
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
---
|
||||||
|
import type { Post } from "../types/global";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
post: Post;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { post, url } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<a href={url}>
|
||||||
|
<div class="frame">
|
||||||
|
<img src="" />
|
||||||
|
<h3>{post.title}</h3>
|
||||||
|
<span class="subtitle">{post.subtitle}</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<div class="bottom-info">
|
||||||
|
<span>Author: {post.author}</span>
|
||||||
|
<span>{post.date}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.frame {
|
||||||
|
flex: auto 0 0;
|
||||||
|
padding: 8px;
|
||||||
|
display: block;
|
||||||
|
border: 2px solid black;
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-height: 230px;
|
||||||
|
width: 220px;
|
||||||
|
border-radius: 12px;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin-top: 8px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-weight: lighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-info {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
9
src/layouts/BlogPostLayout.astro
Normal file
9
src/layouts/BlogPostLayout.astro
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
import Main from "./Main.astro";
|
||||||
|
|
||||||
|
const { frontmatter } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<Main title={frontmatter.title}>
|
||||||
|
<slot/>
|
||||||
|
</Main>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import Footer from "../components/footer.astro";
|
import Footer from "../components/Footer.astro";
|
||||||
import Header from "../components/header.astro";
|
import Header from "../components/Header.astro";
|
||||||
import "../styles/global.css";
|
import "../styles/global.css";
|
||||||
|
|
||||||
const { title } = Astro.props;
|
const { title } = Astro.props;
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
---
|
|
||||||
const { image, title, subtitle, description } = Astro.props;
|
|
||||||
---
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<img src={image} />
|
|
||||||
<h2>{title}</h2>
|
|
||||||
<span class="subtitle">{subtitle}</span>
|
|
||||||
<p>{description}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
div {
|
|
||||||
margin: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
display: block;
|
|
||||||
border: 2px solid black;
|
|
||||||
border-radius: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 12px;
|
|
||||||
aspect-ratio: 1 / 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin-top: 8px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subtitle {
|
|
||||||
font-weight: lighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import Main from "../layouts/main.astro";
|
import Main from "../layouts/Main.astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
<Main title="Über uns" />
|
<Main title="Über uns" />
|
||||||
|
|
@ -1,21 +1,27 @@
|
||||||
---
|
---
|
||||||
import Main from "../layouts/main.astro";
|
import Main from "../layouts/Main.astro";
|
||||||
import PostPreviewSmall from "../layouts/postPreviewSmall.astro";
|
import PostPreviewSmall from "../components/PostPreviewSmall.astro";
|
||||||
|
|
||||||
|
const allPosts: Array<any> = Object.values(
|
||||||
|
import.meta.glob("./posts/*.md", { eager: true })
|
||||||
|
);
|
||||||
---
|
---
|
||||||
|
|
||||||
<Main title="Startseite">
|
<Main title="Startseite">
|
||||||
<div class="grid">
|
<div class="post-grid">
|
||||||
|
{
|
||||||
<div>Test</div><div>Test</div><div>Test</div>
|
allPosts.map((post_file: any) => (
|
||||||
<div>Test</div>
|
<PostPreviewSmall url={post_file.url} post={post_file.frontmatter}> </PostPreviewSmall>
|
||||||
</div>
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</Main>
|
</Main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.grid {
|
.post-grid {
|
||||||
padding: 24px 24px;
|
padding: 24px 24px;
|
||||||
width: 100vw - 48px;
|
display: flex;
|
||||||
display: grid;
|
gap: 16px;
|
||||||
grid-template-columns: auto auto auto auto ;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
8
src/pages/posts/110626_Test1.md
Normal file
8
src/pages/posts/110626_Test1.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: 'The first post'
|
||||||
|
subtitle: "In the first post we're talking about some nice luxury hotels. Stay tuned!"
|
||||||
|
author: 'Tim'
|
||||||
|
date: '11.06.2026'
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is my _great_ post!
|
||||||
8
src/pages/posts/120626_Test2.md
Normal file
8
src/pages/posts/120626_Test2.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: 'The second post'
|
||||||
|
subtitle: 'In the second post we re talking about some nice luxury hotels. Stay tuned!'
|
||||||
|
author: 'Tim'
|
||||||
|
date: '12.06.2026'
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is my _great_ post!
|
||||||
8
src/pages/posts/130626_Test3.md
Normal file
8
src/pages/posts/130626_Test3.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: 'The third post'
|
||||||
|
subtitle: 'In the third post we re talking about some nice luxury hotels. Stay tuned!'
|
||||||
|
author: 'Elli'
|
||||||
|
date: '13.06.2026'
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is my _great_ post!
|
||||||
6
src/types/global.ts
Normal file
6
src/types/global.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
export interface Post {
|
||||||
|
title: String,
|
||||||
|
subtitle: String,
|
||||||
|
date: String,
|
||||||
|
author: String,
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
{
|
{
|
||||||
"extends": "astro/tsconfigs/strict",
|
"extends": "astro/tsconfigs/strict",
|
||||||
"include": [".astro/types.d.ts", "**/*"],
|
"include": [
|
||||||
"exclude": ["dist"]
|
".astro/types.d.ts",
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"jsxImportSource": "preact",
|
||||||
|
"types": ["vite/client"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue