nicer buttons

This commit is contained in:
metacryst
2026-02-28 04:56:19 -06:00
parent 21f654bbed
commit bdd260c2b5
5 changed files with 48 additions and 24 deletions

View File

@@ -1,6 +1,8 @@
/* /*
Sam Russell Sam Russell
Captured Sun Captured Sun
2.27.26 - Adding parentShadow() function
2.16.26 - Adding event objects to the onTouch callbacks
1.16.26 - Moving nav event dispatch out of pushState, adding null feature to attr() 1.16.26 - Moving nav event dispatch out of pushState, adding null feature to attr()
1.5.26 - Switching verticalAlign and horizontalAlign names, adding borderVertical and Horizontal 1.5.26 - Switching verticalAlign and horizontalAlign names, adding borderVertical and Horizontal
12.26.25 - State for arrays, nested objects. State for stacks (Shadow-only) 12.26.25 - State for arrays, nested objects. State for stacks (Shadow-only)
@@ -310,6 +312,17 @@ HTMLElement.prototype.rerender = function() {
quill.rerender(this) quill.rerender(this)
} }
HTMLElement.prototype.parentShadow = function(selector) {
let el = this
while(el !== document.body) {
el = el.parentElement
if(el instanceof Shadow) {
return el
}
}
return null
}
/* Styling */ /* Styling */
window.pct = "%" window.pct = "%"
@@ -1066,9 +1079,9 @@ HTMLElement.prototype.onSubmit = function(cb) {
}; };
HTMLElement.prototype.onTouch = function(cb) { HTMLElement.prototype.onTouch = function(cb) {
const onStart = () => cb.call(this, true); const onStart = (e) => cb.call(this, true, e);
const onEnd = () => cb.call(this, false); const onEnd = (e) => cb.call(this, false, e);
const onCancel = () => cb.call(this, null); const onCancel = (e) => cb.call(this, null, e);
this._storeListener("touchstart", onStart); this._storeListener("touchstart", onStart);
this._storeListener("touchend", onEnd); this._storeListener("touchend", onEnd);
this._storeListener("touchcancel", onCancel); this._storeListener("touchcancel", onCancel);

View File

@@ -111,6 +111,10 @@ body {
border: 1px solid #7a6b55; border: 1px solid #7a6b55;
} }
:root app-window {
border-bottom: 2px solid var(--window);
}
@media (max-width: 480px) { @media (max-width: 480px) {
body, html{ body, html{
overflow-x: hidden; overflow-x: hidden;

View File

@@ -15,7 +15,7 @@ class Dashboard extends Shadow {
.width(this.COL[type], pct) .width(this.COL[type], pct)
.whiteSpace("nowrap") .whiteSpace("nowrap")
.overflowX("auto") .overflowX("auto")
.overflowY("hidden"); .overflowY("hidden")
} }
spawnModal(msg) { spawnModal(msg) {
@@ -25,6 +25,7 @@ class Dashboard extends Shadow {
div.style.left = "50vw" div.style.left = "50vw"
div.style.top = "50vh" div.style.top = "50vh"
div.style.padding = "5em" div.style.padding = "5em"
div.style.borderRadius = "12px"
div.style.position = "fixed" div.style.position = "fixed"
div.style.backgroundColor = "var(--accent)" div.style.backgroundColor = "var(--accent)"
div.style.color = "var(--main)" div.style.color = "var(--main)"

View File

@@ -14,7 +14,7 @@ class AppMenu extends Shadow {
.getPropertyValue("--" + value) .getPropertyValue("--" + value)
.trim(); .trim();
} }
HStack(() => { HStack(() => {
let currentNetwork = global.currentNetwork let currentNetwork = global.currentNetwork
if(!currentNetwork) return if(!currentNetwork) return
@@ -27,16 +27,22 @@ class AppMenu extends Shadow {
.padding(0.3, em) .padding(0.3, em)
.paddingBottom(currentApp === app ? 4 : 5, px) .paddingBottom(currentApp === app ? 4 : 5, px)
.borderBottom(currentApp === app ? "1px solid var(--accent)" : "") .borderBottom(currentApp === app ? "1px solid var(--accent)" : "")
.onClick((done) => { .onClick(function (done) {
if(done) global.openApp(app) if(!done) {
this.style.transform = "translateY(10%)"
} else {
this.style.transform = ""
global.openApp(app)
}
}) })
.onHover(function (hovering) { .onHover(function (hovering) {
if(hovering) { if(hovering) {
this.style.opacity = 0.8 this.style.translateY = -0.1
} else { } else {
this.style.opacity = "" this.style.translateY = ""
} }
}) })
.cursor("pointer")
} }
}) })
.justifyContent("center") .justifyContent("center")

View File

@@ -21,12 +21,16 @@ class Sidebar extends Shadow {
.marginTop(6, vh) .marginTop(6, vh)
.marginBottom(2, vh) .marginBottom(2, vh)
.attr({selected: selected ? "" : null}) .attr({selected: selected ? "" : null})
.paddingRight(0.5, em)
.paddingLeft(selected ? 9 : 10, px) .paddingLeft(selected ? 9 : 10, px)
.borderLeft(selected ? "1px solid var(--accent)" : "0") .borderLeft(selected ? "1px solid var(--accent)" : "0")
.onClick((done, e) => { .cursor("pointer")
if(done) { .transition("transform .1s")
this.toggleSelectedStyles(e.target) .onClick(function (done, e) {
if(!done) {
this.style.transform = "translateX(-10%)"
} else {
this.style.transform = ""
this.parentShadow().toggleSelectedStyles(e.target)
window.navigateTo("/my") window.navigateTo("/my")
} }
}) })
@@ -38,23 +42,19 @@ class Sidebar extends Shadow {
img(`/db/images/${networks[i].logo}`, "2.25em", "2.25em") img(`/db/images/${networks[i].logo}`, "2.25em", "2.25em")
.marginTop(3, vh) .marginTop(3, vh)
.attr({selected: selected ? "" : null}) .attr({selected: selected ? "" : null})
.paddingRight(0.5, em)
.paddingLeft(selected ? 9 : 10, px) .paddingLeft(selected ? 9 : 10, px)
.borderLeft(selected ? "1px solid var(--accent)" : "0") .borderLeft(selected ? "1px solid var(--accent)" : "0")
.onHover(function (hovering) { .cursor("pointer")
if(hovering) { .transition("transform .1s")
this.style.opacity = 0.8 .onClick(function (done, e) {
if(!done) {
this.style.transform = "translateX(-10%)"
} else { } else {
this.style.opacity = "" this.style.transform = ""
} this.parentShadow().toggleSelectedStyles(e.target)
})
.onClick((done, e) => {
if(done) {
this.toggleSelectedStyles(e.target)
window.navigateTo(`/${networks[i].abbreviation}`) window.navigateTo(`/${networks[i].abbreviation}`)
} }
}) })
.cursor("default")
} }
}) })
.paddingLeft(1.5, em) .paddingLeft(1.5, em)