docs(CLAUDE.md): add code style section aligned with glyphdiff conventions
This commit is contained in:
11
src/app.html
Normal file
11
src/app.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
12
src/app/routes/+layout.svelte
Normal file
12
src/app/routes/+layout.svelte
Normal file
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import '../../app.css';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
{@render children()}
|
||||
5
src/app/routes/+page.svelte
Normal file
5
src/app/routes/+page.svelte
Normal file
@@ -0,0 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { HomePage } from '$pages/home';
|
||||
</script>
|
||||
|
||||
<HomePage />
|
||||
1
src/app/styles/app.css
Normal file
1
src/app/styles/app.css
Normal file
@@ -0,0 +1 @@
|
||||
@import "tailwindcss";
|
||||
20
src/app/types/app.d.ts
vendored
Normal file
20
src/app/types/app.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
|
||||
namespace svelte.JSX {
|
||||
interface HTMLAttributes<T> {
|
||||
class?: string;
|
||||
title?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
2
src/entities/index.ts
Normal file
2
src/entities/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Public API for entities layer
|
||||
// Add exports here when entities are implemented
|
||||
2
src/features/index.ts
Normal file
2
src/features/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Public API for features layer
|
||||
// Add exports here when features are implemented
|
||||
1
src/lib/assets/favicon.svg
Normal file
1
src/lib/assets/favicon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="107" height="128" viewBox="0 0 107 128"><title>svelte-logo</title><path d="M94.157 22.819c-10.4-14.885-30.94-19.297-45.792-9.835L22.282 29.608A29.92 29.92 0 0 0 8.764 49.65a31.5 31.5 0 0 0 3.108 20.231 30 30 0 0 0-4.477 11.183 31.9 31.9 0 0 0 5.448 24.116c10.402 14.887 30.942 19.297 45.791 9.835l26.083-16.624A29.92 29.92 0 0 0 98.235 78.35a31.53 31.53 0 0 0-3.105-20.232 30 30 0 0 0 4.474-11.182 31.88 31.88 0 0 0-5.447-24.116" style="fill:#ff3e00"/><path d="M45.817 106.582a20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.503 18 18 0 0 1 .624-2.435l.49-1.498 1.337.981a33.6 33.6 0 0 0 10.203 5.098l.97.294-.09.968a5.85 5.85 0 0 0 1.052 3.878 6.24 6.24 0 0 0 6.695 2.485 5.8 5.8 0 0 0 1.603-.704L69.27 76.28a5.43 5.43 0 0 0 2.45-3.631 5.8 5.8 0 0 0-.987-4.371 6.24 6.24 0 0 0-6.698-2.487 5.7 5.7 0 0 0-1.6.704l-9.953 6.345a19 19 0 0 1-5.296 2.326 20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.502 17.99 17.99 0 0 1 8.13-12.052l26.081-16.623a19 19 0 0 1 5.3-2.329 20.72 20.72 0 0 1 22.237 8.243 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-.624 2.435l-.49 1.498-1.337-.98a33.6 33.6 0 0 0-10.203-5.1l-.97-.294.09-.968a5.86 5.86 0 0 0-1.052-3.878 6.24 6.24 0 0 0-6.696-2.485 5.8 5.8 0 0 0-1.602.704L37.73 51.72a5.42 5.42 0 0 0-2.449 3.63 5.79 5.79 0 0 0 .986 4.372 6.24 6.24 0 0 0 6.698 2.486 5.8 5.8 0 0 0 1.602-.704l9.952-6.342a19 19 0 0 1 5.295-2.328 20.72 20.72 0 0 1 22.237 8.242 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-8.13 12.053l-26.081 16.622a19 19 0 0 1-5.3 2.328" style="fill:#fff"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
1
src/lib/index.ts
Normal file
1
src/lib/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
1
src/pages/home/index.ts
Normal file
1
src/pages/home/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './ui';
|
||||
54
src/pages/home/ui/HomePage.svelte
Normal file
54
src/pages/home/ui/HomePage.svelte
Normal file
@@ -0,0 +1,54 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$shared/ui';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
children?: Snippet;
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
</script>
|
||||
|
||||
<section class="min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 p-8">
|
||||
<div class="max-w-4xl w-full space-y-8 text-center">
|
||||
<h1 class="text-6xl font-bold text-white mb-4 tracking-tight">
|
||||
Welcome to All My Work
|
||||
</h1>
|
||||
|
||||
<p class="text-xl text-slate-300 mb-8 leading-relaxed">
|
||||
A portfolio web application built with SvelteKit, Bun, and modern web technologies.
|
||||
</p>
|
||||
|
||||
<div class="flex gap-4 justify-center flex-wrap">
|
||||
<Button variant="primary" size="lg" onclick={() => alert('Button clicked!')}>
|
||||
Get Started
|
||||
</Button>
|
||||
<Button variant="secondary" size="lg" onclick={() => alert('Secondary action!')}>
|
||||
Learn More
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="mt-16 grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div class="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
||||
<h2 class="text-2xl font-semibold text-white mb-3">SvelteKit</h2>
|
||||
<p class="text-slate-300">Modern full-stack framework with file-based routing</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
||||
<h2 class="text-2xl font-semibold text-white mb-3">Bun</h2>
|
||||
<p class="text-slate-300">Fast runtime and package manager for JavaScript</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white/10 backdrop-blur-lg rounded-lg p-6 border border-white/20">
|
||||
<h2 class="text-2xl font-semibold text-white mb-3">Tailwind CSS</h2>
|
||||
<p class="text-slate-300">Utility-first CSS framework for rapid UI development</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if children}
|
||||
<div class="mt-16">
|
||||
{@render children()}
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
1
src/pages/home/ui/index.ts
Normal file
1
src/pages/home/ui/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as HomePage } from './HomePage.svelte';
|
||||
1
src/pages/index.ts
Normal file
1
src/pages/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './home';
|
||||
1
src/shared/config/index.ts
Normal file
1
src/shared/config/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './site';
|
||||
5
src/shared/config/site.ts
Normal file
5
src/shared/config/site.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export const site = {
|
||||
name: 'allmywork',
|
||||
description: 'Portfolio web application',
|
||||
url: 'https://allmywork.localhost'
|
||||
};
|
||||
3
src/shared/index.ts
Normal file
3
src/shared/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './ui';
|
||||
export * from './config';
|
||||
export * from './lib';
|
||||
18
src/shared/lib/api.ts
Normal file
18
src/shared/lib/api.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
const API_BASE = import.meta.env.VITE_API_BASE || '/api';
|
||||
|
||||
export async function fetchApi(endpoint: string, options?: RequestInit) {
|
||||
const url = `${API_BASE}${endpoint}`;
|
||||
const response = await fetch(url, {
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options?.headers
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`API error: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
1
src/shared/lib/index.ts
Normal file
1
src/shared/lib/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './api';
|
||||
40
src/shared/ui/Button.svelte
Normal file
40
src/shared/ui/Button.svelte
Normal file
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
type?: 'button' | 'submit' | 'reset';
|
||||
variant?: 'primary' | 'secondary' | 'danger';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
disabled?: boolean;
|
||||
onclick?: () => void;
|
||||
children: any;
|
||||
}
|
||||
|
||||
let {
|
||||
type = 'button',
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
disabled = false,
|
||||
onclick,
|
||||
children
|
||||
}: Props = $props();
|
||||
|
||||
const variants = {
|
||||
primary: 'bg-blue-600 text-white hover:bg-blue-700',
|
||||
secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
|
||||
danger: 'bg-red-600 text-white hover:bg-red-700'
|
||||
};
|
||||
|
||||
const sizes = {
|
||||
sm: 'px-3 py-1.5 text-sm',
|
||||
md: 'px-4 py-2 text-base',
|
||||
lg: 'px-6 py-3 text-lg'
|
||||
};
|
||||
</script>
|
||||
|
||||
<button
|
||||
{type}
|
||||
{disabled}
|
||||
onclick={onclick}
|
||||
class="rounded-md font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed {variants[variant]} {sizes[size]}"
|
||||
>
|
||||
{@render children()}
|
||||
</button>
|
||||
26
src/shared/ui/Input.svelte
Normal file
26
src/shared/ui/Input.svelte
Normal file
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
type?: 'text' | 'email' | 'password' | 'number';
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
value?: string;
|
||||
oninput?: (e: Event) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
type = 'text',
|
||||
placeholder = '',
|
||||
disabled = false,
|
||||
value = '',
|
||||
oninput
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<input
|
||||
{type}
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{value}
|
||||
oninput={oninput}
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
/>
|
||||
2
src/shared/ui/index.ts
Normal file
2
src/shared/ui/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as Button } from './Button.svelte';
|
||||
export { default as Input } from './Input.svelte';
|
||||
11
src/tests/basic.test.ts
Normal file
11
src/tests/basic.test.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Basic tests', () => {
|
||||
it('should add numbers correctly', () => {
|
||||
expect(1 + 1).toBe(2);
|
||||
});
|
||||
|
||||
it('should subtract numbers correctly', () => {
|
||||
expect(5 - 3).toBe(2);
|
||||
});
|
||||
});
|
||||
6
src/tests/e2e/homepage.spec.ts
Normal file
6
src/tests/e2e/homepage.spec.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('homepage loads correctly', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await expect(page).toHaveTitle(/allmywork/);
|
||||
});
|
||||
6
src/tests/setup.ts
Normal file
6
src/tests/setup.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { expect, afterEach } from 'vitest';
|
||||
import { cleanup } from '@testing-library/svelte';
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
2
src/widgets/index.ts
Normal file
2
src/widgets/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Public API for widgets layer
|
||||
// Add exports here when widgets are implemented
|
||||
Reference in New Issue
Block a user