mobile changes
This commit is contained in:
@@ -41,6 +41,7 @@ function AppLayout(props: { children: any }) {
|
|||||||
setRightBarVisible(true);
|
setRightBarVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On mobile, leftBarSize() is always 0 (overlay mode)
|
||||||
const newWidth = window.innerWidth - leftBarSize() - rightBarSize();
|
const newWidth = window.innerWidth - leftBarSize() - rightBarSize();
|
||||||
setCenterWidth(newWidth);
|
setCenterWidth(newWidth);
|
||||||
};
|
};
|
||||||
@@ -55,6 +56,7 @@ function AppLayout(props: { children: any }) {
|
|||||||
|
|
||||||
// Recalculate when bar sizes change (visibility or actual resize)
|
// Recalculate when bar sizes change (visibility or actual resize)
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
// On mobile, leftBarSize() is always 0 (overlay mode)
|
||||||
const newWidth = window.innerWidth - leftBarSize() - rightBarSize();
|
const newWidth = window.innerWidth - leftBarSize() - rightBarSize();
|
||||||
setCenterWidth(newWidth);
|
setCenterWidth(newWidth);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
onMount,
|
onMount,
|
||||||
createEffect,
|
createEffect,
|
||||||
createSignal,
|
createSignal,
|
||||||
createMemo,
|
|
||||||
Show,
|
Show,
|
||||||
For,
|
For,
|
||||||
onCleanup
|
onCleanup
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import { Accessor, createContext, useContext, createMemo } from "solid-js";
|
import {
|
||||||
|
Accessor,
|
||||||
|
createContext,
|
||||||
|
useContext,
|
||||||
|
createMemo,
|
||||||
|
onMount,
|
||||||
|
onCleanup
|
||||||
|
} from "solid-js";
|
||||||
import { createSignal } from "solid-js";
|
import { createSignal } from "solid-js";
|
||||||
import { hapticFeedback } from "~/lib/client-utils";
|
import { hapticFeedback } from "~/lib/client-utils";
|
||||||
|
|
||||||
@@ -41,10 +48,26 @@ export function BarsProvider(props: { children: any }) {
|
|||||||
const [leftBarVisible, _setLeftBarVisible] = createSignal(true);
|
const [leftBarVisible, _setLeftBarVisible] = createSignal(true);
|
||||||
const [rightBarVisible, _setRightBarVisible] = createSignal(true);
|
const [rightBarVisible, _setRightBarVisible] = createSignal(true);
|
||||||
const [barsInitialized, setBarsInitialized] = createSignal(false);
|
const [barsInitialized, setBarsInitialized] = createSignal(false);
|
||||||
|
const [windowWidth, setWindowWidth] = createSignal(
|
||||||
|
typeof window !== "undefined" ? window.innerWidth : 1024
|
||||||
|
);
|
||||||
|
|
||||||
let leftBarSized = false;
|
let leftBarSized = false;
|
||||||
let rightBarSized = false;
|
let rightBarSized = false;
|
||||||
|
|
||||||
|
// Track window width reactively for mobile/desktop detection
|
||||||
|
onMount(() => {
|
||||||
|
const handleResize = () => {
|
||||||
|
setWindowWidth(window.innerWidth);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("resize", handleResize);
|
||||||
|
|
||||||
|
onCleanup(() => {
|
||||||
|
window.removeEventListener("resize", handleResize);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const wrappedSetLeftBarSize = (size: number) => {
|
const wrappedSetLeftBarSize = (size: number) => {
|
||||||
if (!barsInitialized()) {
|
if (!barsInitialized()) {
|
||||||
// Before initialization, capture natural size
|
// Before initialization, capture natural size
|
||||||
@@ -88,6 +111,9 @@ export function BarsProvider(props: { children: any }) {
|
|||||||
// Return 0 if hidden (natural size is 0), otherwise return synced size when initialized
|
// Return 0 if hidden (natural size is 0), otherwise return synced size when initialized
|
||||||
const naturalSize = _leftBarNaturalSize();
|
const naturalSize = _leftBarNaturalSize();
|
||||||
if (naturalSize === 0) return 0; // Hidden
|
if (naturalSize === 0) return 0; // Hidden
|
||||||
|
// On mobile (<768px), always return 0 for layout (overlay mode)
|
||||||
|
const isMobile = windowWidth() < 768;
|
||||||
|
if (isMobile) return 0;
|
||||||
return barsInitialized() ? syncedBarSize() : naturalSize;
|
return barsInitialized() ? syncedBarSize() : naturalSize;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function BlogIndex() {
|
|||||||
|
|
||||||
<div class="mx-auto pt-8 pb-24">
|
<div class="mx-auto pt-8 pb-24">
|
||||||
<Suspense fallback={<TerminalSplash />}>
|
<Suspense fallback={<TerminalSplash />}>
|
||||||
<div class="flex flex-col justify-center gap-4 md:flex-row md:justify-around">
|
<div class="flex flex-row justify-around gap-4">
|
||||||
<PostSortingSelect />
|
<PostSortingSelect />
|
||||||
|
|
||||||
<Show when={data() && Object.keys(data()!.tagMap).length > 0}>
|
<Show when={data() && Object.keys(data()!.tagMap).length > 0}>
|
||||||
@@ -33,7 +33,7 @@ export default function BlogIndex() {
|
|||||||
<div class="mt-2 flex justify-center md:mt-0 md:justify-end">
|
<div class="mt-2 flex justify-center md:mt-0 md:justify-end">
|
||||||
<A
|
<A
|
||||||
href="/blog/create"
|
href="/blog/create"
|
||||||
class="border-text rounded border px-4 py-2 transition-all duration-300 ease-out hover:brightness-125 active:scale-90 md:mr-4"
|
class="border-text rounded border px-4 py-2 text-center transition-all duration-300 ease-out hover:brightness-125 active:scale-90 md:mr-4"
|
||||||
>
|
>
|
||||||
Create Post
|
Create Post
|
||||||
</A>
|
</A>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export default function Resume() {
|
|||||||
let iframeRef: HTMLIFrameElement | undefined;
|
let iframeRef: HTMLIFrameElement | undefined;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Prevent iframe errors from bubbling up
|
|
||||||
const handleError = (e: ErrorEvent) => {
|
const handleError = (e: ErrorEvent) => {
|
||||||
if (e.filename?.includes("resume.pdf") || e.message === "Script error.") {
|
if (e.filename?.includes("resume.pdf") || e.message === "Script error.") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -18,7 +17,6 @@ export default function Resume() {
|
|||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
window.removeEventListener("error", handleError, true);
|
window.removeEventListener("error", handleError, true);
|
||||||
|
|
||||||
// Clear iframe source before unmount to prevent script errors
|
|
||||||
if (iframeRef) {
|
if (iframeRef) {
|
||||||
iframeRef.src = "about:blank";
|
iframeRef.src = "about:blank";
|
||||||
}
|
}
|
||||||
@@ -30,7 +28,7 @@ export default function Resume() {
|
|||||||
<Title>Resume | Michael Freno</Title>
|
<Title>Resume | Michael Freno</Title>
|
||||||
<Meta
|
<Meta
|
||||||
name="description"
|
name="description"
|
||||||
content="View Michael Freno's resume - Software Engineer with expertise in full-stack development, game development, and open source."
|
content="View Michael Freno's resume - Software Engineer."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<main class="flex h-screen w-full flex-col">
|
<main class="flex h-screen w-full flex-col">
|
||||||
|
|||||||
Reference in New Issue
Block a user