feat: rebuild board grid experience
This commit is contained in:
1 parent
5dc4dbeaef
commit
0110a2ef63
122 files changed
+9582
-4063
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { ForwardedRef, ReactNode } from "react";
|
||||
import type { FocusEventHandler, ForwardedRef, PointerEventHandler, ReactNode } from "react";
|
||||
import { forwardRef } from "react";
|
||||
import type { ActionIconProps } from "@mantine/core";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
@@ -8,6 +8,8 @@ import { Link } from "@homarr/ui";
|
||||
type HeaderButtonProps = (
|
||||
| {
|
||||
onClick?: () => void;
|
||||
onFocus?: FocusEventHandler<HTMLButtonElement>;
|
||||
onPointerEnter?: PointerEventHandler<HTMLButtonElement>;
|
||||
}
|
||||
| {
|
||||
href: string;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { boardViewportWidthCookieName } from "@homarr/boards/layout-selection";
|
||||
|
||||
export const ViewportHint = () => {
|
||||
useEffect(() => {
|
||||
let timeout: ReturnType<typeof setTimeout> | undefined;
|
||||
const persist = () => {
|
||||
const viewportWidth = document.documentElement.clientWidth || window.innerWidth;
|
||||
document.cookie = `${boardViewportWidthCookieName}=${Math.round(viewportWidth)}; Path=/; Max-Age=31536000; SameSite=Lax`;
|
||||
};
|
||||
const handleResize = () => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(persist, 150);
|
||||
};
|
||||
|
||||
persist();
|
||||
window.addEventListener("resize", handleResize, { passive: true });
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
window.removeEventListener("resize", handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in new issue
Block a user