-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51ead01
commit fd46ec1
Showing
21 changed files
with
1,361 additions
and
485 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/components/toolbars/top-menu/ToggleFullScreen/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { useEffect } from 'react' | ||
import { RiFullscreenLine, RiFullscreenExitLine } from 'react-icons/ri' | ||
|
||
import { cn } from '@/lib/utils' | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipTrigger, | ||
} from '@/components/ui/tooltip' | ||
import { useFullscreenStatus } from '@/lib/hooks' | ||
|
||
export function ToggleFullScreen({ | ||
className = '', | ||
}: { | ||
className?: string | ||
} = {}) { | ||
const [isFullscreen, setFullscreen, ref] = useFullscreenStatus() | ||
|
||
// we want the whole body to become fullscreen | ||
// TODO: use pointer lock, to prevent the mouse from going up | ||
useEffect(() => { | ||
if (typeof window !== 'undefined') { | ||
ref.current = document.body | ||
} | ||
}, [ref]) | ||
|
||
return ( | ||
<Tooltip> | ||
<TooltipTrigger className=""> | ||
<div | ||
className={cn( | ||
`grid h-4 w-5 scale-100 cursor-pointer grid-cols-4 grid-rows-4 overflow-hidden rounded border border-neutral-100 opacity-70 transition-all duration-200 ease-in-out hover:scale-110 hover:opacity-100`, | ||
className | ||
)} | ||
onClick={() => { | ||
setFullscreen(!isFullscreen) | ||
}} | ||
> | ||
<div className="flex h-4 w-4 items-center justify-center"> | ||
<RiFullscreenLine | ||
className={cn( | ||
`absolute -mt-0.5 ml-0.5 h-3 w-3`, | ||
`transition-all duration-200 ease-in-out`, | ||
!isFullscreen ? 'opacity-100' : 'opacity-0' | ||
)} | ||
/> | ||
<RiFullscreenExitLine | ||
className={cn( | ||
`absolute -mt-0.5 ml-0.5 h-3 w-3`, | ||
`transition-all duration-200 ease-in-out`, | ||
isFullscreen ? 'opacity-100' : 'opacity-0' | ||
)} | ||
/> | ||
</div> | ||
</div> | ||
</TooltipTrigger> | ||
<TooltipContent className={cn(`mr-4 mt-2 flex text-xs font-light`)}> | ||
Toggle fullscreen | ||
</TooltipContent> | ||
</Tooltip> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.