add: ImpressumModal added to Footer

This commit is contained in:
Melvin Ragusa
2026-01-22 00:35:27 +01:00
parent faa92414f1
commit 5de0ad18de
8 changed files with 306 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
.overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
backdrop-filter: blur(8px);
padding: 1rem;
}
.modal {
background-color: var(--md-sys-color-surface-container);
border: 1px solid var(--md-sys-color-outline-variant);
border-radius: var(--radius-xl);
padding: var(--space-xl);
width: 100%;
max-width: 560px; /* Slightly wider */
max-height: 90vh;
overflow-y: auto;
position: relative;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Deep shadow */
color: var(--md-sys-color-on-surface);
}
.closeButton {
position: absolute;
top: var(--space-md);
right: var(--space-md);
background: none;
border: none;
cursor: pointer;
color: var(--md-sys-color-on-surface-variant);
padding: 0.5rem;
border-radius: var(--radius-full);
display: flex;
align-items: center;
justify-content: center;
transition: background-color var(--transition-fast), color var(--transition-fast);
}
.closeButton:hover {
background-color: var(--md-sys-color-surface-container-high);
color: var(--md-sys-color-on-surface);
}
.header {
margin-bottom: var(--space-lg);
padding-right: var(--space-xl); /* Make room for close button */
}
.title {
font-family: var(--md-sys-typescale-display-font);
font-size: 1.5rem;
font-weight: 600;
margin: 0;
color: var(--md-sys-color-on-surface);
letter-spacing: -0.025em;
}
.content {
color: var(--md-sys-color-on-surface-variant);
font-family: var(--md-sys-typescale-body-font);
line-height: 1.6;
}
/* Scrollbar styling for webkit browsers */
.modal::-webkit-scrollbar {
width: 8px;
}
.modal::-webkit-scrollbar-track {
background: transparent;
}
.modal::-webkit-scrollbar-thumb {
background-color: var(--md-sys-color-outline-variant);
border-radius: var(--radius-full);
}
.modal::-webkit-scrollbar-thumb:hover {
background-color: var(--md-sys-color-outline);
}

View File

@@ -0,0 +1,93 @@
import { type ReactNode, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { motion, AnimatePresence } from 'motion/react';
import styles from './Modal.module.css';
// I need to check if lucide-react is installed.
// Based on package list, react-icons is installed.
interface ModalProps {
isOpen: boolean;
onClose: () => void;
title?: string;
children: ReactNode;
}
export function Modal({ isOpen, onClose, title, children }: ModalProps) {
// Prevent body scroll when modal is open
useEffect(() => {
if (isOpen) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
}
return () => {
document.body.style.overflow = 'unset';
};
}, [isOpen]);
// Close on escape key
useEffect(() => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', handleEscape);
return () => window.removeEventListener('keydown', handleEscape);
}, [onClose]);
return createPortal(
<AnimatePresence>
{isOpen && (
<motion.div
className={styles.overlay}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
onClick={onClose}
>
<motion.div
className={styles.modal}
initial={{ scale: 0.95, opacity: 0, y: 20 }}
animate={{ scale: 1, opacity: 1, y: 0 }}
exit={{ scale: 0.95, opacity: 0, y: 20 }}
onClick={(e) => e.stopPropagation()}
role="dialog"
aria-modal="true"
aria-labelledby={title ? "modal-title" : undefined}
>
<button
className={styles.closeButton}
onClick={onClose}
aria-label="Close modal"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
{title && (
<div className={styles.header}>
<h2 id="modal-title" className={styles.title}>
{title}
</h2>
</div>
)}
<div className={styles.content}>{children}</div>
</motion.div>
</motion.div>
)}
</AnimatePresence>,
document.body
);
}