Skip to content

Commit

Permalink
feat: iroiro
Browse files Browse the repository at this point in the history
  • Loading branch information
nakasyou committed Apr 27, 2024
1 parent 6814f2c commit 73f3b48
Show file tree
Hide file tree
Showing 20 changed files with 251 additions and 235 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"[astro]": {
"editor.tabSize": 2,
}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 五所川原盛り上げ隊のサイト
Using Astro!

# Astro Starter Kit: Basics

```sh
Expand Down
4 changes: 0 additions & 4 deletions astro.config.mjs

This file was deleted.

8 changes: 8 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'astro/config';

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind()]
});
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[install.scopes]
"@jsr" = "https://npm.jsr.io"
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.7.0",
"@astrojs/check": "^0.5.10",
"@astrojs/tailwind": "^5.1.0",
"@ns/ha": "npm:@jsr/ns__ha",
"astro": "^4.7.0",
"fast-xml-parser": "^4.3.6",
"node-html-parser": "^6.1.13",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
}
}
4 changes: 4 additions & 0 deletions src/assets/brands/instagram.svg
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/hero.jpg
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/logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 0 additions & 61 deletions src/components/Card.astro

This file was deleted.

20 changes: 20 additions & 0 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
import Logo from '../assets/logo.jpeg'
import { Image } from 'astro:assets'
---
<header class="fixed top-0 w-full">
<div class="w-full grid p-2 grid-cols-1 lg:grid-cols-2">
<div class="flex items-center w-full gap-1">
<Image src={Logo} alt='五所川原盛り上げ隊' class="w-12 h-12 rounded-full" />
</div>
<div class="grid place-items-center grid-cols-2 bg-white rounded-full p-1 rounded-tr-none w-full">
<a class="header-link-btn wave">Links</a>
<a class="header-link-btn wave">Contact</a>
</div>
</div>
</header>
<style>
.header-link-btn {
@apply text-slate-600 p-2 rounded-full h-full text-lg font-bold w-full text-center;
}
</style>
41 changes: 41 additions & 0 deletions src/components/Links.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
import { Image } from "astro:assets";
import instagram from "../assets/brands/instagram.svg?raw";
const links: {
name: string;
link: string;
id: string;
image: string | ImageMetadata;
}[] = [
{
name: "Instagram",
link: "https://www.instagram.com/goshogawara_moriagetai",
id: "@goshogawara_moriagetai",
image: instagram,
},
];
---

<div class="grid grid-cols-2 lg:grid-cols-4">
{
links.map((link) => (
<a class="wave" href={link.link}>
<div class="border text-center p-2 rounded-md flex flex-col">
<div class="flex justify-center">
{typeof link.image === "string" ? (
<div
set:html={link.image}
class="text-white w-24 h-24 text-center"
/>
) : (
<Image src={link.image} alt={link.name} class="w-24 h-24" />
)}
</div>
<div>{link.name}</div>
<div>{link.id}</div>
</div>
</a>
))
}
</div>
40 changes: 40 additions & 0 deletions src/components/Posts.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
import { parse } from 'node-html-parser'
const dateFormatter = new Intl.DateTimeFormat('ja-JP', {
dateStyle: 'medium',
timeStyle: 'medium',
timeZone: 'Asia/Tokyo',
})
const items: {
title: string
desc: string
url: string
date: Date
type: 'ameblo' | 'threads'
}[] = []
const ameba = (async () => {
const rss = await fetch('http://rssblog.ameba.jp/goshogawara-moriagetai/rss.html').then(res => res.text())
const json = parse(rss)
for (const item of json.querySelectorAll('item')) {
items.push({
title: item.querySelector('title')?.innerText!,
desc: item.querySelector('description')?.innerText!,
url: item.getAttribute('rdf:about')!,
date: new Date(item.querySelector('dc\\:date')?.innerText!),
type: 'ameblo'
})
}
})()
await Promise.all([ameba])
---
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2">
{
items.map(item => (<a class="wave" href={item.url} data-hcolor="#aaa"><div class="p-2 border rounded-md">
<div class="text-xl font-bold">{item.title}</div>
<div class="text-slate-500 text-sm">{dateFormatter.format(item.date)}</div>
<div>{item.desc.length > 50 ? item.desc.slice(0, 50) + '...' : item.desc}</div>
</div></a>))
}
</div>
1 change: 1 addition & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
28 changes: 28 additions & 0 deletions src/layouts/Base.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
export interface Props {
title: string
}
const { title } = Astro.props
---

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
{
import.meta.env.DEV && <>
<script is:inline src="//cdn.jsdelivr.net/npm/eruda"></script>
<script is:inline>eruda.init();</script>
</>
}
</head>
<body>
<slot />
</body>
</html>
51 changes: 0 additions & 51 deletions src/layouts/Layout.astro

This file was deleted.

23 changes: 23 additions & 0 deletions src/layouts/Page.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
import Base, { type Props as BaseProps } from "./Base.astro"
import Header from "../components/Header.astro"
export type Props = BaseProps & {}
---
<Base {...Astro.props}>
<Header />
<slot />
</Base>
<script>
import { wave } from "@ns/ha"
const buttons =
document.querySelectorAll<HTMLAnchorElement>(".wave")
for (const button of buttons) {
const ha = wave({
color: button.dataset.hcolor ?? '#ddd',
duration: 500,
target: button,
})
button.onpointerdown = (evt) => ha.do({ pos: evt })
}
</script>
Loading

0 comments on commit 73f3b48

Please sign in to comment.