mirror of
https://github.com/cupcakearmy/nicco.io.git
synced 2025-09-09 20:20:42 +00:00
astro first commit
This commit is contained in:
36
src/layouts/BlogPost.astro
Normal file
36
src/layouts/BlogPost.astro
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
import type { CollectionEntry } from 'astro:content'
|
||||
import FormattedDate from '../components/FormattedDate.astro'
|
||||
import { Image } from 'astro:assets'
|
||||
import Root from './Root.astro'
|
||||
|
||||
type Props = CollectionEntry<'blog'>['data']
|
||||
|
||||
const { title, updatedDate, date, tags, coverImage } = Astro.props
|
||||
---
|
||||
|
||||
<Root>
|
||||
<article>
|
||||
<div class="hero-image">
|
||||
{coverImage && <Image width={1020} height={510} src={coverImage} alt="" />}
|
||||
</div>
|
||||
<div class="prose">
|
||||
<div class="title">
|
||||
<div class="date">
|
||||
<FormattedDate date={date} />
|
||||
{
|
||||
updatedDate && (
|
||||
<div class="last-updated-on">
|
||||
Last updated on <FormattedDate date={updatedDate} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<h1>{title}</h1>
|
||||
{tags.map((tag) => <a href={`/tag/${tag}`}>{tag}</a>)}
|
||||
<hr />
|
||||
</div>
|
||||
<slot />
|
||||
</div>
|
||||
</article>
|
||||
</Root>
|
52
src/layouts/PageWithTitle.astro
Normal file
52
src/layouts/PageWithTitle.astro
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
import SpacedLetters from '../components/SpacedLetters.astro'
|
||||
import Root from './Root.astro'
|
||||
|
||||
export type Props = {
|
||||
title: string
|
||||
readable?: boolean
|
||||
expanded?: boolean
|
||||
}
|
||||
|
||||
const { title, readable = false, expanded = true } = Astro.props
|
||||
---
|
||||
|
||||
<Root>
|
||||
<div>
|
||||
<h1>
|
||||
<SpacedLetters letters={title} {readable} />
|
||||
</h1>
|
||||
<section class:list={{ expanded }}>
|
||||
<slot />
|
||||
</section>
|
||||
</div>
|
||||
</Root>
|
||||
|
||||
<style>
|
||||
div {
|
||||
padding: 4rem;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 30rem) {
|
||||
div {
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
section {
|
||||
max-width: 30em;
|
||||
margin-bottom: 4em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
section.expanded {
|
||||
margin-top: 5em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: calc(28vh - 3em);
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
</style>
|
34
src/layouts/Root.astro
Normal file
34
src/layouts/Root.astro
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
import BaseHead from '../components/BaseHead.astro'
|
||||
// import Footer from '../components/Footer.astro'
|
||||
// import Header from '../components/Header.astro'
|
||||
import Nav from '../components/Nav.astro'
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<BaseHead />
|
||||
</head>
|
||||
<body>
|
||||
<!-- <Header /> -->
|
||||
<Nav />
|
||||
<main>
|
||||
<slot />
|
||||
</main>
|
||||
<!-- <Footer /> -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
main {
|
||||
padding-left: 3.5rem;
|
||||
margin: o auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 30rem) {
|
||||
main {
|
||||
padding-left: 2.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user