Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade astro3 #251

Merged
merged 6 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.13.0
20.6.1
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default defineConfig({
syntaxHighlight: "prism",
},
site: "https://cybozu.github.io/",
base: "/frontend-monthly",
base: "frontend-monthly/",
})
5,843 changes: 4,008 additions & 1,835 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.1",
"@astrojs/check": "^0.2.0",
"astro": "^3.0.13",
"dayjs": "^1.11.7",
"github-markdown-css": "^4.0.0"
"github-markdown-css": "^4.0.0",
"typescript": "^5.2.2"
},
"devDependencies": {
"@types/node": "^18.11.18",
Expand Down
Binary file modified public/img/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions src/components/EventSummary.astro
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
---
import type { CollectionEntry } from "astro:content"
import { Image } from "astro:assets"
import headerImg from "../assets/header.png"

export interface Props {
frontmatter: CollectionEntry<"posts">["data"]
}
import dayjs from "dayjs"
import { staticPath } from "../lib/helper"
// import { staticPath } from "../lib/helper"
import StreamInfo from "./StreamInfo.astro"
const { frontmatter } = Astro.props
const startDate = dayjs(frontmatter.date)
const format = "HH:mm"
// const startDate = dayjs(frontmatter.date)
// const format = "HH:mm"
---

<img
src={staticPath("/img/header.png")}
alt=""
width="659"
height="229"
style={{
height: "auto",
maxWidth: "100%",
}}
<Image
src={headerImg}
alt="タイトル画像"
width="660"
height="270"
quality="max"
/>
<h2>イベント概要</h2>
<p>
Expand Down
28 changes: 20 additions & 8 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
---
import { getCollection } from 'astro:content';
import { getCollection } from "astro:content"
import Layout from "../layouts/Layout.astro"
import dayjs from "dayjs"
import { Image } from "astro:assets"
import iconImg from "../assets/icon.jpeg"

const posts = await getCollection('posts');
const contents = await Promise.all(posts.map(async post => {
const posts = await getCollection("posts")
const contents = await Promise.all(
posts
.map(async post => {
const pagePath = `./posts/${post.slug}`
const date = dayjs(post.data.date).format("YYYY/MM/DD")
const title = `#${post.data.no} - ${date}`

const rendered = await post.render();
const headings = rendered.headings.
filter(heading => heading.depth === 3)
const rendered = await post.render()
const headings = rendered.headings.filter(heading => heading.depth === 3)

return { pagePath, title, headings }
})
.reverse())
.reverse()
)
---

<Layout title="Cybozu Frontend Monthly">
<h1 class="title">Cybozu Frontend Monthly</h1>
<h1 class="title">
<Image src={iconImg} alt="" width="50" height="50" />Cybozu Frontend Monthly
</h1>

<ul class="posts">
{
contents.map(content => {
Expand Down Expand Up @@ -50,6 +57,11 @@ const contents = await Promise.all(posts.map(async post => {
line-height: 1.25;
margin-bottom: 16px;
margin-top: 0;
display: flex;
align-items: center;
img {
margin-right: 0.25em;
}
}
.posts {
list-style: none;
Expand Down
10 changes: 6 additions & 4 deletions src/pages/posts/[slug].astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
export interface Props {
post: CollectionEntry<'posts'>
}
import { getCollection, CollectionEntry } from 'astro:content'
import { getCollection } from 'astro:content'
import type { CollectionEntry } from 'astro:content'
import PostLayout from "../../layouts/PostLayout.astro"
import EventSummary from "../../components/EventSummary.astro"
import MembersList from "../../components/MembersList.astro"
import EmbedIntroduceSlide from "../../components/EmbedIntroduceSlide.astro"

export interface Props {
post: CollectionEntry<'posts'>
}

export const getStaticPaths = async () => {
const posts = await getCollection('posts')

Expand Down