first commit

This commit is contained in:
Maurice 2024-05-02 21:23:18 +02:00
commit 7ca31b9b2c
26 changed files with 3445 additions and 0 deletions

18
.containerignore Normal file
View File

@ -0,0 +1,18 @@
Containerfile
.containerignore
.git
.gitignore
.gitattributes
README.md
.npmrc
.prettierrc
.eslintrc.cjs
.editorconfig
.svelte-kit
.vscode
node_modules
build
package
mausenpeet.nl.tar
build.sh
**/.env

13
.eslintignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

31
.eslintrc.cjs Normal file
View File

@ -0,0 +1,31 @@
/** @type { import("eslint").Linter.Config } */
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
mausenpeet.nl.tar

1
.npmrc Normal file
View File

@ -0,0 +1 @@
engine-strict=true

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

20
Containerfile Normal file
View File

@ -0,0 +1,20 @@
FROM node:alpine3.18 AS builder
WORKDIR /staging
COPY . /staging/
RUN corepack enable
RUN pnpm install
RUN pnpm build
RUN pnpm prune --production
FROM node:alpine3.18
RUN apk add --no-cache tzdata
ENV TZ=Europe/Amsterdam
WORKDIR /app
COPY --from=builder /staging/package.json /staging/pnpm-lock.yaml /app/
COPY --from=builder /staging/node_modules /app/node_modules
COPY --from=builder /staging/build /app/build
EXPOSE 3000
CMD ["node", "/app/build/index.js"]

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

3
build.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
podman build --arch=arm64 -t mausenpeet.nl .
podman save --format=oci-archive -o mausenpeet.nl.tar mausenpeet.nl

39
package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "mausenpeet",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-node": "^5.0.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/typography": "^0.5.12",
"@types/eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"autoprefixer": "^10.4.19",
"daisyui": "^4.10.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0-next.4",
"postcss": "^8.4.38",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^5.0.0-next.1",
"svelte-check": "^3.6.0",
"tailwindcss": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
}

3043
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

10
src/app.css Normal file
View File

@ -0,0 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@font-face {
font-family: 'GreatVibes';
src: url('/fonts/GreatVibes-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

13
src/app.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
src/app.html Normal file
View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="nl">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<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>

View File

@ -0,0 +1,84 @@
<script lang="ts">
let { date }: {date: Date} = $props();
function getTimeDifference(date1: Date, date2: Date) {
// Calculate the difference in milliseconds
const diff = Math.abs(date2.getTime() - date1.getTime());
// Time constants
const msPerSecond = 1000;
const msPerMinute = msPerSecond * 60;
const msPerHour = msPerMinute * 60;
const msPerDay = msPerHour * 24;
const msPerWeek = msPerDay * 7;
const msPerYear = msPerDay * 365;
// Calculate each component
const years = Math.floor(diff / msPerYear);
const weeks = Math.floor((diff % msPerYear) / msPerWeek);
const days = Math.floor((diff % msPerWeek) / msPerDay);
const hours = Math.floor((diff % msPerDay) / msPerHour);
const minutes = Math.floor((diff % msPerHour) / msPerMinute);
const seconds = Math.floor((diff % msPerMinute) / msPerSecond);
return {
years: years,
weeks: weeks,
days: days,
hours: hours,
minutes: minutes,
seconds: seconds
};
}
let timeDifference = $state(getTimeDifference(new Date(), date));
setInterval(() => {
timeDifference = getTimeDifference(new Date(), date);
}, 1000);
</script>
<div class="flex justify-center gap-2 flex-wrap font-['GreatVibes']">
{#if timeDifference.years > 0}
<div class="flex flex-col p-5 bg-secondary rounded-box text-secondary-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.years};"></span>
</span>
<span class="text-xl">{timeDifference.years <= 1 ? 'jaar' : 'jaren'}</span>
</div>
{/if}
{#if timeDifference.weeks > 0}
<div class="flex flex-col p-5 bg-primary rounded-box text-primary-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.weeks};"></span>
</span>
<span class="text-xl">{timeDifference.weeks <= 1 ? 'week' : 'weken'}</span>
</div>
{/if}
{#if timeDifference.days > 0}
<div class="flex flex-col p-5 bg-neutral rounded-box text-neutral-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.days};"></span>
</span>
<span class="text-xl">{timeDifference.days <= 1 ? 'dag' : 'dagen'}</span>
</div>
{/if}
<div class="flex flex-col p-5 bg-primary rounded-box text-primary-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.hours};"></span>
</span>
<span class="text-xl">{timeDifference.hours <= 1 ? 'uur' : 'uren'}</span>
</div>
<div class="flex flex-col p-5 bg-neutral rounded-box text-neutral-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.minutes};"></span>
</span>
<span class="text-xl">{timeDifference.minutes <= 1 ? 'minuut' : 'minuten'}</span>
</div>
<div class="flex flex-col p-5 bg-secondary rounded-box text-secondary-content text-center">
<span class="countdown font-mono text-5xl">
<span style="--value:{timeDifference.seconds};"></span>
</span>
<span class="text-xl">seconde</span>
</div>
</div>

5
src/lib/index.ts Normal file
View File

@ -0,0 +1,5 @@
import Counter from "./components/Counter.svelte";
export { Counter };
// place files you want to import through the `$lib` alias in this folder.

View File

@ -0,0 +1,5 @@
<script>
import '../app.css';
</script>
<slot />

23
src/routes/+page.svelte Normal file
View File

@ -0,0 +1,23 @@
<script>
import Counter from "$lib/components/Counter.svelte";
const date = new Date('2025-05-15T12:00:00');
const msPerDay = 60000 * 60 * 24;
const diff = Math.abs(date.getTime() - Date.now());
let daysLeft = Math.floor(diff / msPerDay);
</script>
<main class="m-5">
<article class="prose mx-auto pt-5">
<div class="text-center font-['GreatVibes']">
<h1 class="md:text-7xl text-5xl font-thin mb-0 pb-0">Maurice & Petra</h1>
<h2 class="mt-0 pt-0 md:text-5xl text-3xl font-thin text-primary">trouwen {date.toLocaleDateString()}</h2>
<Counter {date} />
<p class="text-2xl">Dus nog <span class="text-primary">{daysLeft}</span> nachtjes slapen</p>
</div>
</article>
</main>

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

18
svelte.config.js Normal file
View File

@ -0,0 +1,18 @@
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
}
};
export default config;

15
tailwind.config.js Normal file
View File

@ -0,0 +1,15 @@
import daisyui from 'daisyui';
import typography from '@tailwindcss/typography';
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,svelte,js,ts}'],
theme: {
extend: {},
},
plugins: [daisyui, typography],
daisyui: {
themes: ["luxury"],
},
}

19
tsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

6
vite.config.ts Normal file
View File

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});