This commit is contained in:
metacryst
2025-09-06 20:26:07 -05:00
parent 7194b48b14
commit eff0c160a5
47 changed files with 2470 additions and 254 deletions

View File

@@ -0,0 +1,16 @@
css(`
page-footer {
display: flex;
justify-content: flex-end;
}
`)
export default class Footer extends HTMLElement {
connectedCallback() {
this.innerHTML += /* html */`
`
}
}
customElements.define("page-footer", Footer)

View File

@@ -0,0 +1,150 @@
css(`
nav-bar {
position: fixed;
top: 0px;
left: 0px;
width: 100vw;
z-index: 1;
height: 100px;
}
.title-div {
position: absolute;
left: 2em;
top: 2em;
display: flex;
align-items: center;
}
.links-div {
position: absolute;
right: 3em;
top: 2.75em;
display: flex;
}
.logo-p {
font-size: 2em;
margin: 0 0 0 15px;
letter-spacing: 1px;
text-align: center;
}
.nav-hamburger {
margin-right: 8vw;
display: none;
max-height:40px;
}
.nav-link {
font-size: 1em;
margin: 0 0 0 15px;
letter-spacing: 1px;
}
@media only screen and (max-width: 820px) {
nav-bar a {
text-decoration: none;
color: var(--green);
}
.title-div {
position: static
}
.logo {
width: 10vw;
}
.logo-p {
font-size: 8vw;
margin: 0 0 0 1vw;
}
.nav-hamburger {
display: block;
}
.links-div {
display:none;
}
.outer-nav {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 20vw;
background: var(--tan);
display: flex;
z-index: 1;
justify-content: space-between;
align-items: center;
padding: 0 3vw;
max-height:80px;
}
}
`)
export default class NavBar extends HTMLElement {
connectedCallback() {
this.innerHTML += /* html */ `
<div class="outer-nav">
<div style="display: flex; align-items: center;">
<a draggable="false" href="/" id="homeLink" style="display: flex; align-items: center; text-decoration: none; color: var(--green);">
<div class="title-div">
<img class="logo" width="40" height="40" src="_/icons/logo.svg"/>
<p class="logo-p">Hyperia</p>
</div>
</a>
</div>
<div class="links-div">
<a draggable="false" href="/about" class="nav-link">About</a>
<a draggable="false" href="/join" class="nav-link">Join</a>
<a draggable="false" href="/login" class="nav-link">Login</a>
</div>
<!-- Right side: hamburger -->
<img class="nav-hamburger" src="_/icons/hamburger.svg">
</div>
</div>
`;
// Track which anchor was pressed down
let activeLink = null;
// Get all anchor tags inside this element
const anchors = this.querySelectorAll('a');
anchors.forEach(anchor => {
anchor.addEventListener('mousedown', (e) => {
activeLink = anchor;
});
});
// Listen globally for mouseup, to detect release anywhere
document.addEventListener('mouseup', (e) => {
if (activeLink) {
// Navigate to the href of the activeLink
window.location.href = activeLink.href;
activeLink = null;
}
});
const hamburger = this.querySelectorAll("img")[1]
const sidebar = document.querySelector("side-bar");
hamburger.addEventListener("click", () => {
if (sidebar.style.right === "0vw") {
sidebar.style.right = "-100vw";
} else {
sidebar.style.right = "0vw";
}
});
}
}
customElements.define("nav-bar", NavBar)

View File

@@ -0,0 +1,27 @@
css(`
nav-menu {
position: fixed;
bottom: 6vh;
right: 6vh;
width: 20vw;
height: 10vh;
background: var(--green);
color: var(--tan);
border: 20px solid var(--tan);
}
`)
export default class NavMenu extends HTMLElement {
connectedCallback() {
this.innerHTML += /* html */ `
<span style="display: block; height: 2vh; background-color: var(--tan); border-radius: 2px;"></span>
<span style="display: block; height: 2vh; background-color: var(--tan); border-radius: 2px;"></span>
<span style="display: block; height: 2vh; background-color: var(--tan); border-radius: 2px;"></span>
<p style="font-size: 3vh; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%)">Menu</p>
`
document.addEventListener("")
}
}
customElements.define("nav-menu", NavMenu)

View File

@@ -0,0 +1,46 @@
css(`
side-bar {
position: fixed;
top: 0;
right: -100vw;
width: 80vw;
height: 100vh;
background: var(--tan);
border-left: 1px solid var(--green);
transition: right 0.3s ease;
z-index: 10;
padding: 5vw;
}
side-bar a {
font-size: 8vw;
color: var(--red)
}
side-bar h2 {
font-size: 6vw
}
`)
export default class SideBar extends HTMLElement {
connectedCallback() {
this.innerHTML += /* html */`
<h2>Menu</h2>
<ul style="list-style: none; padding: 0;">
<li><a href="/join">Join</a></li>
<li><a href="/locations">Locations</a></li>
<li><a href="/donate">Donate</a></li>
<li><a href="/events">Events</a></li>
<li><a href="/login">Login</a></li>
</ul>
<img src="_/icons/x.svg" style="margin-top: 70vw; width: 10vw; height: 10vw" onclick="">
`
this.querySelector("img").addEventListener("click", () => {
const sidebar = document.querySelector("side-bar");
sidebar.style.right = "-100vw"
})
}
}
customElements.define("side-bar", SideBar)

143
ui/public/index.css Normal file
View File

@@ -0,0 +1,143 @@
.card-header {
padding: 2vw;
}
.card-content {
padding: 2vw;
}
.card-footer {
padding: 10px 10px 3vw;
display: flex;
justify-content: center;
font-size: 1.2em;
}
.card a {
background: #af936226;
margin-right: 10px;
}
.card-image figure {
margin: 0;
padding: 0;
}
p {
font-size: 1.2em;
}
.card {
width: 40vw;
border: 1px solid var(--green);
}
.card-image img {
width: 100%;
height: 40vh;
object-fit: cover;
display: block;
}
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 5vw;
max-width: 90vw;
margin-top: 20vh;
margin-left: 5vw;
margin-bottom: 5vw
}
@font-face {
font-family: 'CrimsonText';
src: url('/_/CrimsonText/CrimsonText-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'CrimsonText';
src: url('/_/CrimsonText/CrimsonText-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
@media screen and (max-width: 600px){
.card a {
background: var(--green);
margin-right: 10px;
}
body {
font-family: 'CrimsonText', sans-serif;
background-color: var(--tan);
color: var(--green);
}
:root {
--green: #0B5538;
--tan: #FFDFB4;
}
.card-image img {
height: 70vh;
}
.card {
margin-bottom: 4vw;
padding-bottom: 4vw;
width: auto;
}
.content a {
background: var(--green);
color: var(--tan);
border-radius: 6px;
padding: 1vw;
}
.card-footer-item {
background: var(--green);
color: var(--tan);
border-radius: 6px;
padding: 1vw;
margin-right: 1vw;
text-decoration: none;
}
.card-header {
padding: 2vw;
}
.card-content {
padding: 2vw;
}
.card-image {
margin: 0; /* Removes spacing around image container */
padding: 0;
}
.card-image figure {
margin: 0;
padding: 0;
}
.card-footer {
padding: 10px 10px 10px 2vw;
font-size: 1.2em;
display: flex;
justify-content: center;
}
.grid-container {
display: grid;
grid-template-columns: repeat(1, 1fr);
gap: 5vw;
max-width: 90vw;
margin-left: auto;
margin-right: auto;
}
}

76
ui/public/index.html Normal file
View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hyperia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="_/icons/logo.svg">
<link rel="stylesheet" href="_/code/shared.css">
<link rel="stylesheet" href="index.css">
<style>
:root {
--green: #0B5538;
--tan: #FFDFB4;
--red: #BC1C02;
--brown: #c6a476
}
#items {
position: absolute;
top: 45vh;
left: 50vw;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center; /* centers children horizontally */
text-align: center; /* ensures text inside spans is centered */
}
#title {
font-size: 22vh;
}
a {
cursor: default;
text-decoration: underline;
text-underline-offset: 5px;
transition: background .02s, color .2s;
user-select: none;
display: inline-block; /* makes background and padding behave */
padding: 0.2em 0.5em; /* adds breathing room */
}
a:hover {
text-decoration: none;
background: var(--green);
color: var(--tan);
}
a:active {
background: var(--red); /* background color works now */
color: white; /* optional: change text color for contrast */
}
</style>
<script src="_/code/util.js"></script>
<script type="module">
import PageFooter from "./components/Footer.js"
import NavBar from "./components/NavBar.js"
import SideBar from "./components/SideBar.js"
</script>
</head>
<body>
<div id="items">
<span id="title" style="font-family: Canterbury; color: var(--red); margin-bottom: 10vh">hyperia</span>
<img src="_/icons/logo.svg" style="width: 17vh; z-index: 1">
<img src="_/icons/left_plant.svg" style="position: absolute; left: 25%; top: 23vh; width: 70%; transform: translateX(-50%)">
<img src="_/icons/right_plant.svg" style="position: absolute; left: 75%; top: 23vh; width: 70%; transform: translateX(-50%)">
<div style="height: 2vh"></div>
<span style="font-family: Canterbury; color: black; font-size: 5vh;">A <br>Society</span>
<div style="height: 2vh"></div>
<div style="color: black; font-size: 2.2vh; z-index: 1; cursor: default;">
<a>ABOUT</a> | <a>SERVICES</a> | <a>JOIN</a>
</div>
</div>
</body>
</html>

68
ui/public/paintingTags.js Normal file
View File

@@ -0,0 +1,68 @@
// Create the hover display element
const hoverBox = document.createElement('div');
hoverBox.style.id = "hoverBox"
hoverBox.style.position = 'fixed';
hoverBox.style.padding = '8px 12px';
hoverBox.style.backgroundColor = 'var(--green)';
hoverBox.style.border = '1px solid var(--tan)';
hoverBox.style.color = 'var(--tan)';
hoverBox.style.opacity = '80%';
hoverBox.style.pointerEvents = 'none';
hoverBox.style.zIndex = '9999';
hoverBox.style.fontFamily = 'sans-serif';
hoverBox.style.fontSize = '14px';
hoverBox.style.display = 'none';
document.body.appendChild(hoverBox);
let currentTarget = null;
function capitalizeWords(str) {
return str
.split('-')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}
function onMouseOver(e) {
const target = e.target;
let paintingName; let artistName;
if(target.id === "back") {
paintingName = "The Garden Terrace"
artistName = "Caspar David Friedrich"
} else if (target.tagName.toLowerCase() === 'img' && target.classList.contains('interactive')) {
const match = target.src.match(/([^\/]+)\.([a-z]{3,4})(\?.*)?$/i); // extract filename
if (!match) return;
const filename = match[1];
const parts = filename.split('_');
if (parts.length !== 2) return;
paintingName = capitalizeWords(parts[0]);
artistName = capitalizeWords(parts[1]);
} else {
return
}
hoverBox.innerHTML = `<strong>${paintingName}</strong><br><span style="font-size: 12px;">${artistName}</span>`;
hoverBox.style.display = 'block';
currentTarget = target;
hoverBox.style.left = `${e.clientX + 15}px`;
hoverBox.style.top = `${e.clientY + 15}px`;
}
function onMouseOut(e) {
if (e.target === currentTarget) {
hoverBox.style.display = 'none';
currentTarget = null;
}
}
function onMouseMove(e) {
if (hoverBox.style.display === 'block') {
hoverBox.style.left = `${e.clientX + 15}px`;
hoverBox.style.top = `${e.clientY + 15}px`;
}
}
document.addEventListener('mouseover', onMouseOver);
document.addEventListener('mouseout', onMouseOut);
document.addEventListener('mousemove', onMouseMove);

56
ui/public/scrollEffect.js Normal file
View File

@@ -0,0 +1,56 @@
let treeOriginalTop = null;
let currentVelocity = 0;
let isAnimating = false;
window.addEventListener('wheel', (e) => {
if(window.innerWidth < 600) {
return;
}
// Add scroll delta to the velocity
currentVelocity += e.deltaY;
// Start animation loop if not running
if (!isAnimating) {
isAnimating = true;
requestAnimationFrame(animateScroll);
}
}, { passive: false });
function animateScroll() {
const tree = document.getElementById("tree");
if (!treeOriginalTop) {
treeOriginalTop = parseInt(getComputedStyle(tree).top);
}
const treeHeightPX = 0.83 * window.innerHeight;
let treeTopPX = parseInt(getComputedStyle(tree).top);
// Limit per-frame speed (but NOT total speed)
let multiplier = window.innerHeight / 2000;
let delta = Math.max(-100 * multiplier, Math.min(100 * multiplier, currentVelocity));
// Apply the scroll
let newTop = treeTopPX - delta;
// Clamp top/bottom bounds
const maxTop = treeOriginalTop;
const minTop = treeOriginalTop - treeHeightPX;
if (newTop > maxTop) newTop = maxTop;
if (newTop < minTop) newTop = minTop;
tree.style.top = `${newTop}px`;
// Slowly reduce velocity
currentVelocity *= 0.85;
// If velocity is small, stop
if (Math.abs(currentVelocity) > 0.5) {
requestAnimationFrame(animateScroll);
} else {
isAnimating = false;
currentVelocity = 0;
}
}