-
Notifications
You must be signed in to change notification settings - Fork 0
/
repomix-output.txt
2474 lines (2157 loc) · 73.5 KB
/
repomix-output.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This file is a merged representation of the entire codebase, combining all repository files into a single document.
Generated by Repomix on: 2024-12-04T18:16:43.731Z
================================================================
File Summary
================================================================
Purpose:
--------
This file contains a packed representation of the entire repository's contents.
It is designed to be easily consumable by AI systems for analysis, code review,
or other automated processes.
File Format:
------------
The content is organized as follows:
1. This summary section
2. Repository information
3. Repository structure
4. Multiple file entries, each consisting of:
a. A separator line (================)
b. The file path (File: path/to/file)
c. Another separator line
d. The full contents of the file
e. A blank line
Usage Guidelines:
-----------------
- This file should be treated as read-only. Any changes should be made to the
original repository files, not this packed version.
- When processing this file, use the file path to distinguish
between different files in the repository.
- Be aware that this file may contain sensitive information. Handle it with
the same level of security as you would the original repository.
Notes:
------
- Some files may have been excluded based on .gitignore rules and Repomix's
configuration.
- Binary files are not included in this packed representation. Please refer to
the Repository Structure section for a complete list of file paths, including
binary files.
Additional Info:
----------------
For more information about Repomix, visit: https://github.com/yamadashy/repomix
================================================================
Repository Structure
================================================================
.gitignore
astro.config.mjs
netlify.toml
package.json
public/_redirects
README.md
robots.txt
scripts/createBlogPost.ts
src/components/blog/BlogImage.astro
src/components/common/AnimateableText.astro
src/components/common/BaseHead.astro
src/components/common/ConnectItem.astro
src/components/common/CubesBackground.astro
src/components/common/Footer.astro
src/components/common/Header.astro
src/components/common/HeaderLink.astro
src/components/common/Page.astro
src/components/common/SvgItem.astro
src/components/home/StackItem.astro
src/components/portfolio/PortfolioItem.astro
src/components/workExperience/WorkExperienceItem.astro
src/consts.ts
src/content/blog/my-first-blog-post/index.md
src/content/config.ts
src/env.d.ts
src/layouts/BlogPost.astro
src/pages/404.astro
src/pages/blog/[...slug].astro
src/pages/blog/index.astro
src/pages/index.astro
src/pages/portfolio.astro
src/pages/work-experience.astro
src/styles/global.css
src/types/common.ts
src/utils/gitDates.ts
src/utils/imageUtils.ts
src/utils/seoSchema.ts
tailwind.config.js
tsconfig.json
================================================================
Repository Files
================================================================
================
File: .gitignore
================
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
/dist
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store
================
File: astro.config.mjs
================
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
export default defineConfig({
site: "https://jub.dk",
integrations: [
mdx(),
sitemap({
filter: (page) => !page.includes("/blog/drafts/"),
changefreq: "weekly",
priority: 0.7,
lastmod: new Date(),
}),
tailwind(),
],
image: {
service: { entrypoint: "astro/assets/services/sharp" },
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
formats: ["avif", "webp"],
minimumCacheTTL: 60 * 60 * 24 * 7, // 1 week
quality: 80,
},
compressHTML: true,
build: {
inlineStylesheets: "auto",
},
});
================
File: netlify.toml
================
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"
Permissions-Policy = "camera=(), microphone=(), geolocation=()"
Content-Security-Policy = """
default-src 'self';
script-src 'self' 'unsafe-inline' https://analytics.wip.dk https://cdnjs.cloudflare.com;
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
font-src 'self' data:;
connect-src 'self' https://analytics.wip.dk;
frame-ancestors 'none';
form-action 'self';
base-uri 'self';
object-src 'none';
worker-src 'none';
manifest-src 'self';
"""
[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
================
File: package.json
================
{
"name": "portfolio",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"create-blog": "tsx scripts/createBlogPost.ts"
},
"dependencies": {
"@astrojs/mdx": "^4.0.1",
"@astrojs/rss": "^4.0.9",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/tailwind": "^5.1.3",
"@tailwindcss/typography": "^0.5.15",
"astro": "^5.0.1",
"sharp": "^0.33.5",
"tailwindcss": "^3.3.3"
},
"devDependencies": {
"@types/node": "^22.10.1",
"node-html-parser": "^6.1.6",
"prettier-plugin-astro": "^0.8.1",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
}
}
================
File: public/_redirects
================
/js/script.pageview-props.tagged-events.js https://analytics.wip.dk/js/script.pageview-props.tagged-events.js 200
/api/event https://analytics.wip.dk/api/event 200
/* /index.html 200
================
File: README.md
================
# Portfolio Showcase 🚀
Welcome to my Portfolio repository! This is where I showcase my tech stack, highlight the projects I've worked on, and provide access to my CV.
## Features:
- **Tech Stack:** Explore the technologies and tools that I'm proficient in.
- **Project Showcase:** Dive into the details of the exciting projects I've had the pleasure of working on.
- **CV:** Get to know my professional journey and qualifications through my Curriculum Vitae.
> **Note:** Icons used in this portfolio are provided by [Simple Icons](https://simpleicons.org/).
Made with :heart: in Aalborg, Denmark
================
File: robots.txt
================
User-agent: *
Allow: /
Disallow: /api/
# Prevent indexing of specific file types
Disallow: /*.json$
Disallow: /*.xml$
# Allow image indexing
Allow: /*.jpg$
Allow: /*.jpeg$
Allow: /*.png$
Allow: /*.webp$
# Sitemaps
Sitemap: https://jub.dk/sitemap-index.xml
================
File: scripts/createBlogPost.ts
================
import { promises as fs } from 'fs';
import path from 'path';
import readline from 'readline';
const BLOG_DIR = path.join(process.cwd(), 'src', 'content', 'blog');
const PUBLIC_BLOG_ASSETS = path.join(process.cwd(), 'public', 'assets', 'blog');
interface BlogPostDetails {
title: string;
slug: string;
description: string;
keywords: string[];
}
async function promptUser(): Promise<BlogPostDetails> {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const question = (query: string): Promise<string> =>
new Promise(resolve => rl.question(query, resolve));
const title = await question('Enter blog post title: ');
const defaultSlug = title
.toLowerCase()
.replace(/[^a-zA-Z0-9\s]/g, '')
.replace(/\s+/g, '-');
const slugInput = await question(`Enter slug (press enter to use "${defaultSlug}"): `);
const slug = slugInput.trim() || defaultSlug;
const description = await question('Enter blog post description: ');
const defaultKeywords = ['software development', 'web development', 'programming'];
const keywordsInput = await question(`Enter keywords (comma-separated, press enter for defaults: ${defaultKeywords.join(', ')}): `);
const keywords = keywordsInput.trim()
? keywordsInput.split(',').map(k => k.trim())
: defaultKeywords;
rl.close();
return { title, slug, description, keywords };
}
async function createBlogPost(details: BlogPostDetails) {
const postDir = path.join(BLOG_DIR, details.slug);
// Create blog post directory
await fs.mkdir(postDir, { recursive: true });
// Ensure public blog assets directory exists
await fs.mkdir(PUBLIC_BLOG_ASSETS, { recursive: true });
// Create frontmatter content
const currentDate = new Date().toISOString().split('T')[0];
const frontmatter = `---
title: '${details.title}'
description: '${details.description}'
pubDate: '${currentDate}'
# updatedDate: '${currentDate}'
draft: true
keywords: [${details.keywords.map(k => `'${k}'`).join(', ')}]
# heroImage: '/blog/${details.slug}/hero.webp'
# heroAlt: 'Alt text for hero image'
---
Write your blog post content here...
## Images
Add images to your blog post:
1. Place your images in \`public/assets/blog/${details.slug}/\`
2. For hero image:
- Add the image to \`public/assets/blog/${details.slug}/hero.webp\`
- Uncomment and update heroImage & heroAlt in frontmatter
3. Reference images in your content:
\`\`\`markdown
![Image description](/assets/blog/${details.slug}/your-image.webp)
\`\`\`
## SEO Optimization
This blog post includes:
- ✅ Title and description
- ✅ Keywords for better search visibility
- ⏳ Hero image (pending)
- ⏳ Content (pending)
## Before Publishing
1. Add your content
2. Add and configure hero image
3. Review and update keywords if needed
4. Set draft: false when ready to publish
5. If making major updates later, uncomment and update the updatedDate
## Image Optimization Tips
- Use .webp format for better performance
- Optimize images before adding them
- Include meaningful alt text
- Recommended hero image size: 1200x630px (optimal for social sharing)
`;
// Create index.md with frontmatter
await fs.writeFile(path.join(postDir, 'index.md'), frontmatter);
// Create blog-specific assets directory in public folder
const publicPostDir = path.join(PUBLIC_BLOG_ASSETS, details.slug);
await fs.mkdir(publicPostDir, { recursive: true });
// Create a README in the public assets directory
const assetsReadme = `# Blog Assets for "${details.title}"
Store your blog post images here.
## Directory Structure
/public/assets/blog/${details.slug}/
├── hero.webp # Main image for the blog post
└── other-images/ # Additional images used in the post
## Recommendations
- Use .webp format
- Optimize images before adding them
- Recommended hero image size: 1200x630px
- Keep filenames descriptive but simple
- Include meaningful alt text when referencing images
## Reference Images in Markdown
\`\`\`markdown
![Image description](/assets/blog/${details.slug}/your-image.webp)
\`\`\`
## Tools for Image Optimization
- squoosh.app - Browser-based image optimization
- imageoptim.com - Desktop app for macOS
- tinypng.com - Online PNG and JPEG compression`;
await fs.writeFile(path.join(publicPostDir, 'README.md'), assetsReadme);
return {
postDir,
assetsDir: publicPostDir
};
}
async function main() {
try {
console.log('🚀 Creating new blog post...\n');
const details = await promptUser();
const { postDir, assetsDir } = await createBlogPost(details);
console.log('\n✅ Blog post created successfully!');
console.log('\nDirectories created:');
console.log('Content:', postDir);
console.log('Assets:', assetsDir);
console.log('\nNext steps:');
console.log('1. Add your content to index.md');
console.log(`2. Add images to ${assetsDir}`);
console.log('3. Review and update SEO elements (keywords, description)');
console.log('4. Set draft: false when ready to publish');
console.log('\nPro tips:');
console.log('- Use .webp format for images');
console.log('- Optimize images before adding them');
console.log('- Hero image size: 1200x630px (optimal for social sharing)');
} catch (error) {
console.error('\n❌ Error creating blog post:', error);
process.exit(1);
}
}
main();
================
File: src/components/blog/BlogImage.astro
================
---
import { Image } from 'astro:assets';
import type { ImageMetadata } from 'astro';
import type { ImageProps } from '../../types/common';
interface Props extends ImageProps {
format?: 'webp' | 'avif';
quality?: number;
}
const { src, alt } = Astro.props;
// Import all images from assets directory
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/**/*.{jpeg,jpg,png,gif,webp}', { eager: true });
// Function to get image path
function getImagePath(src: string) {
// Handle absolute paths from src/assets
if (src.startsWith('/src/assets/')) {
return src;
}
// Handle paths without /src/assets prefix
if (src.startsWith('/')) {
return `/src/assets${src}`;
}
// Handle relative paths
return `/src/assets/${src}`;
}
const imagePath = getImagePath(src);
const resolvedImage = images[imagePath]?.default;
if (!resolvedImage) {
console.warn(`Image not found: ${imagePath}`);
console.warn('Available images:', Object.keys(images));
}
---
{resolvedImage ? (
<Image
src={resolvedImage}
alt={alt}
width={800}
height={resolvedImage.height * (800 / resolvedImage.width)}
format="webp"
quality={80}
loading="lazy"
class="rounded-lg"
onerror="this.onerror=null;this.src='/assets/fallback-image.webp';"
/>
) : (
<div class="bg-gray-800 rounded-lg p-4 text-center">
<span class="text-gray-400">Image not available</span>
</div>
)}
================
File: src/components/common/AnimateableText.astro
================
<div class="flex flex-row gap-1 relative mt-1 mx-auto md:mx-0 w-full justify-center md:justify-start">
<p class="text-2xl">I'm a</p>
<p class="text-2xl text-primary relative overflow-hidden" id="animateableText"></p>
</div>
<script>
class TextAnimator {
private element: HTMLElement | null;
private texts: string[];
private currentIndex: number;
private delay: number;
private isAnimating: boolean;
constructor(elementId: string, texts: string[], delay: number) {
this.element = document.getElementById(elementId);
this.texts = texts;
this.currentIndex = 0;
this.delay = delay;
this.isAnimating = false;
}
animate() {
if (!this.element) return;
// Update text content
this.element.textContent = this.texts[this.currentIndex];
// Reset animation by removing and re-adding the pseudo-element class
this.element.classList.remove('animate-typing');
void this.element.offsetWidth; // Force reflow
this.element.classList.add('animate-typing');
// Prepare for next text
this.currentIndex = (this.currentIndex + 1) % this.texts.length;
// Schedule next animation
setTimeout(() => this.animate(), this.delay);
}
start() {
if (this.element) {
this.element.classList.add('animate-typing');
this.animate();
}
}
}
// Initialize when document is ready
document.addEventListener('DOMContentLoaded', () => {
const animator = new TextAnimator('animateableText', [
"fullstack developer",
"devOps engineer",
"home automation tinker",
"dark mode enthusiast",
], 5000);
animator.start();
});
</script>
<style>
#animateableText {
min-height: 1.5em;
}
.animate-typing {
position: relative;
}
.animate-typing::before {
content: "";
position: absolute;
display: inline-block;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: var(--color-body, #1f2022);
border-left: 2px solid var(--color-primary, #4070f4);
animation: textAnimation 5s steps(24) infinite;
animation-delay: 300ms;
}
@keyframes textAnimation {
40%, 60% {
left: 100%;
}
100% {
left: 0%
}
}
:global(.dark) .animate-typing::before {
background-color: var(--color-body-dark, #1f2022);
border-left-color: var(--color-primary-dark, #4070f4);
}
</style>
================
File: src/components/common/BaseHead.astro
================
---
import { SITE_TITLE } from '../../consts';
import { generateSchemaOrg } from '../../utils/seoSchema';
import defaultOgImage from '../../assets/julius.jpg'; // Import the default image
import type { SEOProps } from '../../types/common';
export interface Props extends SEOProps {}
const {
title,
description = "Julius Bendt - Fullstack developer, DevOps engineer and dark mode enthusiast",
image,
type = 'website',
publishedDate,
modifiedDate,
keywords = ["fullstack developer", "devops engineer", "software engineer", "web developer", "Julius Bendt"]
} = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const fullTitle = title ? `${title} | ${SITE_TITLE}` : SITE_TITLE;
// Use the image URL if provided, otherwise use the default image
const imageUrl = image ? new URL(image, Astro.site) : new URL(defaultOgImage.src, Astro.site);
const schemaOrg = generateSchemaOrg({
type,
title: fullTitle,
description,
url: canonicalURL.toString(),
image: imageUrl.toString(),
publishedDate,
modifiedDate
});
---
<!-- Global Metadata -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="generator" content={Astro.generator} />
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1" />
<link rel="preconnect" href="https://analytics.wip.dk" />
<link rel="preconnect" href="https://cdnjs.cloudflare.com" />
<!-- Primary Meta Tags -->
<title>{fullTitle}</title>
<meta name="title" content={fullTitle} />
<meta name="description" content={description} />
<meta name="author" content="Julius Bendt" />
<meta name="keywords" content={keywords.join(', ')} />
<meta name="robots" content="index, follow" />
<link rel="canonical" href={canonicalURL} />
<!-- Open Graph / Facebook -->
<meta property="og:site_name" content={SITE_TITLE} />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content={type} />
<meta property="og:url" content={Astro.url} />
<meta property="og:title" content={fullTitle} />
<meta property="og:description" content={description} />
<meta property="og:image" content={imageUrl} />
<meta property="og:image:alt" content={`Image for ${fullTitle}`} />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<!-- <meta property="twitter:site" content="@juliusbendt" /> -->
<!-- <meta property="twitter:creator" content="@juliusbendt" /> -->
<meta property="twitter:url" content={Astro.url} />
<meta property="twitter:title" content={fullTitle} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={imageUrl} />
<!-- Article Specific Meta (only for blog posts) -->
{type === 'article' && publishedDate && (
<meta property="article:published_time" content={publishedDate.toISOString()} />
)}
{type === 'article' && modifiedDate && (
<meta property="article:modified_time" content={modifiedDate.toISOString()} />
)}
<!-- Structured Data -->
<script type="application/ld+json" set:html={JSON.stringify(schemaOrg)} />
<!-- Preload Fonts -->
<link
rel="preload"
href="/assets/font/Inter-Regular.ttf"
as="font"
type="font/ttf"
crossorigin
/>
================
File: src/components/common/ConnectItem.astro
================
---
import SvgItem from './SvgItem.astro';
import type { LinkProps } from '../../types/common';
interface Props extends LinkProps {
icon: string;
fillColor: string;
text: string;
}
const {
icon,
fillColor,
text,
href,
class: className = "",
ariaLabel = `Connect on ${text}`
} = Astro.props;
// Determine if the link is external
const isExternal = href.startsWith('http');
---
<a
href={href}
target={isExternal ? "_blank" : undefined}
rel={isExternal ? "noopener noreferrer" : undefined}
class:list={[
"group relative",
"inline-flex items-center gap-2",
"px-3 py-2",
"rounded-lg",
"transition-all duration-300",
"hover:bg-white/10",
"focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-body",
className
]}
aria-label={ariaLabel}
>
<div class="flex items-center gap-2 transform group-hover:scale-105 transition duration-300 ease-in-out">
<SvgItem
icon={icon}
fillColor={fillColor}
svgClass="w-5 h-5"
/>
<span class="text-sm font-medium group-hover:text-primary transition-colors">
{text}
</span>
</div>
{isExternal && (
<span
class="sr-only"
aria-hidden="true"
>
(opens in new tab)
</span>
)}
<!-- Tooltip -->
<div
class="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 text-sm
bg-gray-900 text-white rounded opacity-0 invisible
group-hover:opacity-100 group-hover:visible
transition-all duration-200 pointer-events-none"
role="tooltip"
>
Connect on {text}
<div
class="absolute top-full left-1/2 transform -translate-x-1/2 -mt-1
border-4 border-transparent border-t-gray-900"
>
</div>
</div>
</a>
<style>
@keyframes ripple {
to {
transform: scale(4);
opacity: 0;
}
}
/* Ensure the link takes up the right amount of space */
a.group {
position: relative;
overflow: hidden;
isolation: isolate;
}
/* Improve focus visibility */
a.group:focus-visible {
outline: 2px solid theme(colors.primary);
outline-offset: 2px;
}
/* Custom animation for icon bounce */
@media (prefers-reduced-motion: no-preference) {
.group:hover svg {
animation: iconBounce 0.5s ease-in-out;
}
}
@keyframes iconBounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-3px); }
}
</style>
================
File: src/components/common/CubesBackground.astro
================
---
{/* Your imports */}
---
<div id="background-container" class="fixed inset-0 overflow-hidden pointer-events-none" style="z-index: -1;">
<svg id="background-svg" width="100%" height="100%" style="position: absolute; top: 0; left: 0;">
<!-- Shapes will be added here -->
</svg>
</div>
<script>
console.log("Script starting...");
class Shape {
element: SVGElement;
x: number;
y: number;
rotation: number;
rotationSpeed: number;
moveSpeed: number;
size: number;
originalY: number;
opacity: number;
isResetting: boolean;
constructor(svg: SVGSVGElement, index: number, startAtBottom = false) {
this.size = Math.random() * 20 + 20;
this.element = this.createCube();
svg.appendChild(this.element);
// Initial position
this.x = Math.random() * window.innerWidth;
if (startAtBottom) {
// Start new shapes at the bottom
this.y = window.innerHeight + this.size;
} else {
// Initial distribution for startup
const section = window.innerHeight / 5;
this.y = (index * section) + (Math.random() * section);
}
this.originalY = this.y;
this.rotation = Math.random() * 360;
this.rotationSpeed = (Math.random() - 0.5) * 0.1;
this.moveSpeed = Math.random() * 0.05 + 0.02;
this.opacity = 0.2;
this.isResetting = false;
this.element.style.fill = 'currentColor';
this.element.style.opacity = this.opacity.toString();
this.element.style.transition = 'opacity 1s ease-in-out';
this.update(0);
}
createCube(): SVGElement {
const cube = document.createElementNS("http://www.w3.org/2000/svg", "rect");
cube.setAttribute("width", this.size.toString());
cube.setAttribute("height", this.size.toString());
cube.setAttribute("rx", (this.size * 0.3).toString());
return cube;
}
reset() {
// Start fade out
this.isResetting = true;
this.element.style.opacity = "0";
// After fade out, reset position
setTimeout(() => {
this.y = window.innerHeight + this.size;
this.x = Math.random() * window.innerWidth;
this.originalY = this.y;
this.isResetting = false;
// Fade back in after position reset
setTimeout(() => {
this.element.style.opacity = this.opacity.toString();
}, 100);
}, 1000);
}
update(scrollY: number) {
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
this.element.setAttribute("transform", `translate(${this.x} ${this.y})`);
return;
}
if (this.isResetting) return;
// Very slow upward movement
this.y -= this.moveSpeed;
this.rotation += this.rotationSpeed;
// Start reset when shape is near the top
if (this.y + this.size < 100 && !this.isResetting) {
this.reset();
return;
}
const scrollProgress = scrollY / (document.documentElement.scrollHeight - window.innerHeight);
const parallaxY = scrollY * 0.15;
const scrollEffect = Math.sin(scrollProgress * Math.PI * 2) * 20;
const finalY = this.y + parallaxY + scrollEffect;
const finalX = this.x + Math.sin(scrollProgress * Math.PI * 2 + this.x) * 5;
this.element.setAttribute("transform", `
translate(${finalX} ${finalY})
rotate(${this.rotation} ${this.size/2} ${this.size/2})
`);
}
}
function initBackground() {
const svgElement = document.getElementById('background-svg');
if (!svgElement || !(svgElement instanceof SVGSVGElement)) {
console.error("SVG element not found or is not an SVGSVGElement!");
return;
}
const numberOfShapes = 40;
const shapes = Array.from({ length: numberOfShapes }, (_, i) => new Shape(svgElement as SVGSVGElement, i));
let lastScrollY = window.scrollY;
let ticking = false;
function animate() {
shapes.forEach(shape => shape.update(lastScrollY));
requestAnimationFrame(animate);
}
window.addEventListener('scroll', () => {
lastScrollY = window.scrollY;
if (!ticking) {
window.requestAnimationFrame(() => {
shapes.forEach(shape => shape.update(lastScrollY));
ticking = false;
});
ticking = true;
}
}, { passive: true });
animate();
}
// Run initialization when the document is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initBackground);
} else {
initBackground();
}
</script>
<style is:global>
#background-svg rect {
fill: var(--color-primary);
}
@media (prefers-color-scheme: dark) {
#background-svg rect {
fill: var(--color-primary-dark, var(--color-primary));
}
}
</style>
================
File: src/components/common/Footer.astro
================
---
const today = new Date();
---
<footer class="sticky top-[100vh] px-8 py-4 text-center md:text-right ">
<span class="md:float-right sm:place-content-center">To fork a version of this portfolio, please visit the <a href="https://github.com/Julius-Bendt/portfolio/" target="_blank" class="text-primary" href="#"> Github repository</a></span>
</footer>
================
File: src/components/common/Header.astro
================
---
import HeaderLink from './HeaderLink.astro';
import { SITE_TITLE } from '../../consts';
const navigationLinks = [
{ href: '/', text: 'Home', ariaLabel: 'Navigate to home page' },