initial code

This commit is contained in:
Lio 2024-05-24 01:40:11 +02:00
commit e6a2c2f7d6
19 changed files with 4949 additions and 0 deletions

24
.gitignore vendored Normal file
View file

@ -0,0 +1,24 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store
# jetbrains setting folder
.idea/

4
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

11
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"deno.enable": false
}

4
README.md Normal file
View file

@ -0,0 +1,4 @@
# Phobos
https://jankraus.net/2024/04/05/how-to-build-a-simple-photo-gallery-with-astro/
https://jankraus.net/photography/albums/hamburg/

17
astro.config.mjs Normal file
View file

@ -0,0 +1,17 @@
import { defineConfig } from "astro/config";
import yaml from "@rollup/plugin-yaml";
import tailwind from "@astrojs/tailwind";
import node from "@astrojs/node";
import react from "@astrojs/react";
// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), react()],
output: "server",
adapter: node({
mode: "standalone",
}),
vite: {
plugins: [yaml()],
},
});

7
config.json Normal file
View file

@ -0,0 +1,7 @@
{
"title": "Gallery",
"description": "this is a description",
"icon": "https://common.himbo.cat/avatars/lio/drip.jpg",
"background": "https://javacat.io/siteBG2-min.png",
"socials": [{ "name": "bsky", "url": "https://pogcha.mp" }]
}

29
package.json Normal file
View file

@ -0,0 +1,29 @@
{
"name": "",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/node": "^8.2.5",
"@astrojs/react": "^3.4.0",
"@astrojs/tailwind": "^5.1.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"astro": "^4.9.1",
"pocketbase": "^0.21.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
},
"devDependencies": {
"@rollup/plugin-yaml": "^4.1.2"
}
}

4596
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

9
public/favicon.svg Normal file
View file

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

After

Width:  |  Height:  |  Size: 749 B

61
src/components/Card.astro Normal file
View file

@ -0,0 +1,61 @@
---
interface Props {
title: string;
body: string;
href: string;
}
const { href, title, body } = Astro.props;
---
<li class="link-card">
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 1px;
background-color: #23262d;
background-image: none;
background-size: 400%;
border-radius: 7px;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: calc(1.5rem - 1px);
border-radius: 8px;
color: white;
background-color: #23262d;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
background-image: var(--accent-gradient);
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent-light));
}
</style>

View file

@ -0,0 +1,14 @@
---
import { Image as AstroImage } from "astro:assets";
const { src, alt } = Astro.props;
---
<AstroImage
src={src}
alt={alt}
inferSize={true}
format="avif"
quality={50}
class="rounded mb-4 border border-transparent hover:border-gray-300 transition-all duration-300 ease-in-out hover:shadow-lg max-w-48"
loading="lazy"
/>

View file

@ -0,0 +1,26 @@
---
import { Image } from "astro:assets";
import config from "../../config.json";
const {class} = Astro.props
---
<aside>
<div>
<h1>{config.title}</h1>
<p class="text-red-500 md:text-black">awa</p>
<Image class={"icon"} src={config.icon} alt={""} inferSize />
</div>
</aside>
<style>
img.icon {
width: 10rem;
height: 10rem;
margin: 50px auto;
object-fit: cover;
object-position: center;
border-radius: 100%;
}
</style>

19
src/config.d.ts vendored Normal file
View file

@ -0,0 +1,19 @@
declare module "*config.yaml" {
const value: {
title?: string;
description?: string;
icon?: string;
background?: string;
socials: {
name: string;
link: string;
icon?: string;
}[];
};
export default value;
}
declare module "*.yaml" {
const value: any; // Add type definitions here if desired
export default value;
}

1
src/env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="astro/client" />

67
src/layouts/Layout.astro Normal file
View file

@ -0,0 +1,67 @@
---
import config from "../../config.json";
import Sidebar from "../components/Sidebar.astro";
const { title, background } = config;
---
<!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>
</head>
<body>
<div
class="relative container left-60 p-8 box-border mx-auto transition-all"
>
<div
class="fixed left-0 top-0 w-96 bg-[#ffffff59] h-full pt-8 z-[9999] box-border"
>
<Sidebar />
</div>
<slot />
</div>
</body>
</html>
<style define:vars={{ background: `url(${background})` }}>
.container {
width: calc(100% - 25rem);
}
body {
font-family: system-ui, sans-serif;
background: var(--background);
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
}
/*
:root {
--accent: 136, 58, 234;
--accent-light: 224, 204, 250;
--accent-dark: 49, 10, 101;
--accent-gradient: linear-gradient(
45deg,
rgb(var(--accent)),
rgb(var(--accent-light)) 30%,
white 60%
);
}
code {
font-family:
Menlo,
Monaco,
Lucida Console,
Liberation Mono,
DejaVu Sans Mono,
Bitstream Vera Sans Mono,
Courier New,
monospace;
} */
</style>

42
src/pages/index.astro Normal file
View file

@ -0,0 +1,42 @@
---
import Layout from "../layouts/Layout.astro";
import Image from "../components/Image.astro";
const images = [
"https://randomfox.ca/images/1.jpg",
"https://randomfox.ca/images/2.jpg",
"https://randomfox.ca/images/3.jpg",
"https://randomfox.ca/images/4.jpg",
"https://randomfox.ca/images/5.jpg",
"https://randomfox.ca/images/6.jpg",
"https://randomfox.ca/images/7.jpg",
"https://randomfox.ca/images/8.jpg",
"https://randomfox.ca/images/9.jpg",
"https://randomfox.ca/images/10.jpg",
"https://randomfox.ca/images/11.jpg",
"https://randomfox.ca/images/12.jpg",
"https://randomfox.ca/images/13.jpg",
"https://randomfox.ca/images/14.jpg",
"https://randomfox.ca/images/15.jpg",
"https://randomfox.ca/images/16.jpg",
"https://randomfox.ca/images/17.jpg",
"https://randomfox.ca/images/18.jpg",
"https://randomfox.ca/images/19.jpg",
"https://randomfox.ca/images/20.jpg",
];
---
<Layout>
<div class="text-center my-16 mb-32">
... album title and description ...
<div class="columns-3">
{images.map((image) => <Image src={image} alt="" />)}
</div>
... rest of the page ...
</div>
</Layout>
<!-- <style>
</style> -->

8
tailwind.config.mjs Normal file
View file

@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [],
}

7
tsconfig.json Normal file
View file

@ -0,0 +1,7 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}