DavidHDev / react-haiku

A clean & lightweight collection of React Hooks & Utilities!
https://reacthaiku.dev/
Other
236 stars 48 forks source link

Feature: added documentation and demo for useFullscreen hook #73

Closed francoisdillinger closed 1 month ago

francoisdillinger commented 1 month ago

Pull Request Description

Description Added UseFullscreenDemo.jsx and useFullscreen.mdx files for documentation details. Also, added useFullscreen to docs/README.md.

Acceptance Criteria

Note I added two examples to the useFullscreen.mdx file because I wasn't sure if this hook was only supposed to be used for making a window fullscreen. The first example shows with the document.documentElement being used; however, if this was the intended purpose, couldn't it just be done in the hook itself? It will also work with an element, but then only that element is enlarged to fullscreen, not the entire document. I looked through previous pull requests but the one I saw mentioning it didn't explicitly define which purpose was intended, unless I overlooked it. If the option is intentional, I would imagine a refactor could be made where the hook would set the document.documentElement by default unless another reference was passed to it. Either way, here is how it looks at the moment.

Demo: useFullscreen

DavidHDev commented 1 month ago

I agree the document could have been set as the default ref from inside the hook, let's leave it as an improvement for the future