App: responsywnosc na telefonie - dvh zamiast 100vh, viewport-fit=cover, dolny pasek podkadowany do visualViewport (bez skokow i znikania paska przy klawiaturze i pasku adresu)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#141210" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link rel="icon" href="/icons/icon-192.png" type="image/png" />
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function App() {
|
||||
}, [init]);
|
||||
|
||||
if (!ready) {
|
||||
return <div className="flex items-center justify-center min-h-screen text-dim">Ładowanie…</div>;
|
||||
return <div className="flex items-center justify-center min-h-dvh text-dim">Ładowanie…</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Brandmark } from './Brandmark';
|
||||
+ panel formularza. Na mobile — jeden słupek (branding u góry). */
|
||||
export default function AuthShell({ subtitle, children }: { subtitle: string; children: ReactNode }) {
|
||||
return (
|
||||
<div className="relative flex min-h-screen items-center justify-center p-4">
|
||||
<div className="relative flex min-h-dvh items-center justify-center p-4">
|
||||
<ThemeToggle className="fixed right-4 top-4 z-10" />
|
||||
<div className="grid w-full max-w-3xl overflow-hidden rounded-2xl border border-line bg-card shadow-card md:grid-cols-2">
|
||||
<div
|
||||
|
||||
@@ -207,7 +207,7 @@ export default function Layout() {
|
||||
|
||||
return (
|
||||
<ToastProvider>
|
||||
<div className="min-h-screen md:flex">
|
||||
<div className="min-h-dvh md:flex">
|
||||
{/* Mobile drawer (telefon): ten sam zestaw pozycji co sidebar, zawsze rozwinięty */}
|
||||
{drawerOpen && (
|
||||
<div className="fixed inset-0 z-50 md:hidden">
|
||||
|
||||
@@ -54,7 +54,7 @@ export function ToastProvider({ children }: { children: ReactNode }) {
|
||||
{children}
|
||||
<div
|
||||
aria-live="polite"
|
||||
className="pointer-events-none fixed bottom-[76px] left-4 right-4 z-[70] flex flex-col gap-2 sm:left-auto sm:right-4 sm:w-80 md:bottom-4"
|
||||
className="pointer-events-none fixed bottom-[calc(4.25rem+env(safe-area-inset-bottom))] left-4 right-4 z-[70] flex flex-col gap-2 sm:left-auto sm:right-4 sm:w-80 md:bottom-4"
|
||||
>
|
||||
{toasts.map((t) => {
|
||||
const { icon: Icon, cls } = TOAST_STYLES[t.kind];
|
||||
|
||||
@@ -37,7 +37,7 @@ const DialogContent = React.forwardRef<
|
||||
data-slot="dialog-content"
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'fixed inset-x-0 bottom-0 z-50 max-h-[85vh] w-full overflow-y-auto rounded-t-2xl border border-line bg-card p-5 shadow-card',
|
||||
'fixed inset-x-0 bottom-0 z-50 max-h-[85dvh] w-full overflow-y-auto rounded-t-2xl border border-line bg-card p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-card',
|
||||
'sm:bottom-auto sm:left-1/2 sm:right-auto sm:top-1/2 sm:max-w-md sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl',
|
||||
'duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-bottom-2',
|
||||
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { ChevronLeft, Filter, Menu, MoreHorizontal, Plus, Search, X } from 'lucide-react';
|
||||
import { useTopbarStore } from './store';
|
||||
@@ -52,6 +53,32 @@ function ActionButton({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telefon: dystans (px) od dołu layout viewportu do dołu *widzialnego* viewportu.
|
||||
* Gdy otwiera się klawiatura (lub zwija pasek adresu), dolny pasek jest przypinany
|
||||
* do dolnej krawędzi visualViewport zamiast skakać / znikać za ekranem.
|
||||
* 0 = pasek zostaje przy dole ekranu (desktop, brak klawiatury).
|
||||
*/
|
||||
function useVisualViewportBottom() {
|
||||
const [bottom, setBottom] = useState(0);
|
||||
useEffect(() => {
|
||||
const vv = window.visualViewport;
|
||||
if (!vv) return;
|
||||
const update = () => {
|
||||
const offset = Math.max(0, Math.round(window.innerHeight - vv.height - vv.offsetTop));
|
||||
setBottom(offset);
|
||||
};
|
||||
update();
|
||||
vv.addEventListener('resize', update);
|
||||
vv.addEventListener('scroll', update);
|
||||
return () => {
|
||||
vv.removeEventListener('resize', update);
|
||||
vv.removeEventListener('scroll', update);
|
||||
};
|
||||
}, []);
|
||||
return bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu kontekstowe otwartej zakładki (jedno menu, trzy zachowania responsywne):
|
||||
* - PC (lg+): wszystkie opcje rozwinięte inline z automatu (bez akordeonu);
|
||||
@@ -65,6 +92,8 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
const openGroup = useTopbarStore((s) => s.openGroup);
|
||||
const setOpenGroup = useTopbarStore((s) => s.setOpenGroup);
|
||||
const navigate = useNavigate();
|
||||
// telefon: dolny pasek podąża za widzialnym viewportem (klawiatura / pasek adresu)
|
||||
const vvBottom = useVisualViewportBottom();
|
||||
const section = config?.search;
|
||||
const searchQuery = useListSearch((s) => (section ? s.queries[section] : ''));
|
||||
|
||||
@@ -107,6 +136,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
'flex shrink-0 items-center gap-2 md:flex-wrap md:justify-end',
|
||||
'max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:z-40 max-md:justify-center max-md:gap-2 max-md:border-t max-md:border-line max-md:bg-card max-md:px-3 max-md:pt-2 max-md:pb-[max(0.5rem,env(safe-area-inset-bottom))]',
|
||||
)}
|
||||
style={vvBottom > 0 ? { bottom: vvBottom } : undefined}
|
||||
>
|
||||
{/* nawigacja (np. Kalendarz) zawsze widoczna, nie jest grupą */}
|
||||
{config?.navWidget}
|
||||
|
||||
Reference in New Issue
Block a user