feat: extend document to ignore startViewTransition type error
This commit is contained in:
parent
f161e54368
commit
09441cffce
|
|
@ -214,7 +214,7 @@ async function Home() {
|
|||
<ul className="pt-10 grid grid-cols-1 sm:grid-cols-3 gap-8">
|
||||
{feature.subfeatures.map((item) => (
|
||||
<li
|
||||
className="border rounded-xl overflow-hidden bg-white hover:shadow-md hover:scale-105 cursor-pointer transition duration-300 cursor-default"
|
||||
className="border rounded-xl overflow-hidden bg-white hover:shadow-md hover:scale-105 transition duration-300 cursor-default"
|
||||
key={item.title}
|
||||
>
|
||||
{item.screenshot?.src && (
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { create } from "zustand"
|
|||
|
||||
import { noop } from "~/lib/noop"
|
||||
import { delStorage, getStorage, setStorage } from "~/lib/storage"
|
||||
import { isServerSide, isViewTransition } from "~/lib/utils"
|
||||
import { isServerSide } from "~/lib/utils"
|
||||
|
||||
import { useGetState } from "./useGetState"
|
||||
|
||||
|
|
@ -183,7 +183,9 @@ export const useDarkMode = () => {
|
|||
storageKey: darkModeKey,
|
||||
element: (globalThis.document && document.documentElement) || mockElement,
|
||||
transition:
|
||||
!isServerSide() && isViewTransition() // @ts-ignore
|
||||
!isServerSide() &&
|
||||
!!document.startViewTransition &&
|
||||
!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches
|
||||
? document.startViewTransition()
|
||||
: undefined,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ export function pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {
|
|||
|
||||
export const isServerSide = () => typeof window === "undefined"
|
||||
|
||||
export const isViewTransition = () =>
|
||||
// @ts-ignore
|
||||
!!document.startViewTransition &&
|
||||
!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches
|
||||
|
||||
export const throttle = (func: Function, limit: number) => {
|
||||
let inThrottle: boolean
|
||||
return function () {
|
||||
|
|
|
|||
|
|
@ -11,4 +11,8 @@ declare global {
|
|||
}
|
||||
|
||||
var prisma: PrismaClient | undefined
|
||||
|
||||
interface Document {
|
||||
startViewTransition(): void
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue