refactor(components): add window dragging + remove resize

This commit is contained in:
Walid 2023-04-20 15:56:29 +00:00
parent 32dfc41589
commit 9652ec9122
Signed by: Walidoux
GPG Key ID: CCF21881FE8BEBAF

View File

@ -5,31 +5,33 @@ import { Image } from '../Image'
export const TitleBar: React.FC = () => { export const TitleBar: React.FC = () => {
return ( return (
<nav className='flex h-[37.5px] items-center justify-between bg-[#1f1f1f] text-white'> <nav className='flex w-full h-[40px] items-center justify-between bg-[#1f1f1f] text-white'>
<Image src='/Logo.svg' size={60} className='ml-3 p-1' /> <div
className='w-full select-none'
onMouseDown={async () => {
return await appWindow.startDragging()
}}>
<Image src='/Logo.svg' size={60} className='ml-3 p-1' />
</div>
<ul className='flex h-full'> <ul className='flex h-full'>
<li <li
className='grid h-full w-14 cursor-pointer place-items-center transition-colors duration-[10ms] hover:bg-[#2a2a2a]'
onClick={async () => { onClick={async () => {
return await appWindow.minimize() return await appWindow.minimize()
}} }}>
className='grid h-full w-14 cursor-pointer place-items-center transition-colors duration-[10ms] hover:bg-[#2a2a2a]'>
<Minus /> <Minus />
</li> </li>
<li
onClick={async () => { <li className='grid h-full w-14 place-items-center cursor-not-allowed opacity-40'>
return (await appWindow.isMaximized())
? await appWindow.unmaximize()
: await appWindow.maximize()
}}
className='grid h-full w-14 cursor-pointer place-items-center transition-colors duration-[10ms] hover:bg-[#2a2a2a]'>
<Maximize size={20} /> <Maximize size={20} />
</li> </li>
<li <li
className='grid h-full w-14 cursor-pointer place-items-center transition-colors duration-[10ms] hover:bg-red-500'
onClick={async () => { onClick={async () => {
return await appWindow.close() return await appWindow.close()
}} }}>
className='grid h-full w-14 cursor-pointer place-items-center transition-colors duration-[10ms] hover:bg-red-500'>
<X /> <X />
</li> </li>
</ul> </ul>