Initial commit
This commit is contained in:
35
src/app/layout.tsx
Normal file
35
src/app/layout.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
'use client'
|
||||
|
||||
import { Lexend } from 'next/font/google'
|
||||
import './globals.css'
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const lexend = Lexend({
|
||||
subsets: ['latin']
|
||||
})
|
||||
|
||||
export default function RootLayout ({
|
||||
children
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
}>) {
|
||||
const handleMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if ((e.target as HTMLElement).closest('button')) return
|
||||
getCurrentWindow().startDragging()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
document.body.addEventListener('mousedown', handleMouseDown as any)
|
||||
return () =>
|
||||
document.body.removeEventListener('mousedown', handleMouseDown as any)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<html lang='en'>
|
||||
<body className={lexend.className}>
|
||||
<div className='w-max h-screen'>{children}</div>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user