refactor: rename layouts for App & Blog

This commit is contained in:
Ayo Ayco 2024-09-04 20:06:55 +02:00
parent aa271c8050
commit ebf7baa1ed
5 changed files with 20 additions and 34 deletions

View file

@ -51,7 +51,6 @@ const appTitle = article?.title ? `${article.title} | Cozy` : 'Cozy';
<body>
<div id="app-wrapper">
<Jumbotron />
<main>
<slot />
<div id="main-content">
<div id="post-wrapper">
@ -61,7 +60,6 @@ const appTitle = article?.title ? `${article.title} | Cozy` : 'Cozy';
<slot name="library" />
</div>
</div>
</main>
<slot name="footer" />
</div>
</body>
@ -75,11 +73,9 @@ const appTitle = article?.title ? `${article.title} | Cozy` : 'Cozy';
}
#app-wrapper {
width: 100%;
max-width: 650px;
padding: 0.5rem;
padding-bottom: 5em;
padding: 0 0.5em 10em;
display: grid;
gap: 1em;
&:has(#router-outlet #post) {
#jumbotron {
@ -87,16 +83,6 @@ const appTitle = article?.title ? `${article.title} | Cozy` : 'Cozy';
}
}
}
#main-content {
* {
margin: 1rem 0 0;
}
#post-wrapper {
padding: 0 1rem;
}
}
</style>
<style is:global>
:root {

View file

@ -1,5 +1,5 @@
---
import Layout from "../layouts/Layout.astro";
import App from "../layouts/App.astro";
import Library from "../components/Library.astro";
import Footer from "../components/Footer.astro";
import SimpleAddressBar from "../components/SimpleAddressBar.astro";
@ -8,7 +8,7 @@ export const prerender = false;
---
<Layout article={null}>
<App article={null}>
<SimpleAddressBar url='' />
<div slot="post" id="router-outlet">
<h1>
@ -17,4 +17,4 @@ export const prerender = false;
</div>
<Library slot="library" skipSave />
<Footer slot="footer" />
</Layout>
</App>

View file

@ -1,6 +1,6 @@
---
import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
import Blog from '../../layouts/Blog.astro';
export async function getStaticPaths() {
const posts = await getCollection('blog');
@ -15,6 +15,6 @@ const post = Astro.props;
const { Content } = await post.render();
---
<BlogPost {...post.data}>
<Blog {...post.data}>
<Content />
</BlogPost>
</Blog>

View file

@ -2,7 +2,7 @@
import { ArticleData, extract } from "@extractus/article-extractor";
import SimpleAddressBar from "../components/SimpleAddressBar.astro";
import Post from "../components/Post.astro";
import Layout from "../layouts/Layout.astro";
import App from "../layouts/App.astro";
import Library from "../components/Library.astro";
import Footer from "../components/Footer.astro";
@ -23,11 +23,11 @@ if (url)
}
---
<Layout article={article}>
<App article={article}>
<SimpleAddressBar url={url} />
<div slot="post" id="router-outlet">
<Post article={article} />
</div>
<Library slot="library" skipSave={article === null} />
<Footer slot="footer" />
</Layout>
</App>