Skip to content

Releases: pedro-lb/use-window-size-hook

1.1.22

26 Jun 18:33
Compare
Choose a tag to compare

πŸ’… Improvements

  • πŸ’… Improved safety with using with SSR (Server Side Rendering) projects - won't break when window or document is not defined.

  • πŸ’… Improved type safety - screenLayout is now always returned by useWindowSize.

1.1.2

16 Jun 21:46
Compare
Choose a tag to compare

πŸ’… Improvements

  • πŸ’… Added more layout disposition options under screenLayout returned by useWindowSize! Refer to the readme:

useWindowSize result

{
  width?: number;
  height?: number;
  screenLayout?: {
    layout: xs | sm | md | lg | xl;

    isXs: boolean;
    isSm: boolean;
    isMd: boolean;
    isLg: boolean;
    isXl: boolean;

    isXsOrBelow: boolean;
    isSmOrBelow: boolean;
    isMdOrBelow: boolean;
    isLgOrBelow: boolean;
    isXlOrBelow: boolean;

    isXsOrAbove: boolean;
    isSmOrAbove: boolean;
    isMdOrAbove: boolean;
    isLgOrAbove: boolean;
    isXlOrAbove: boolean;
  };
}

1.1.1

16 Jun 21:26
Compare
Choose a tag to compare

⚠️ Breaking changes

  • useWindowSize is not exported as default anymore. You'll have to:
import { useWindowSize } from "use-window-size-hook";

1.1.0

16 Jun 21:26
Compare
Choose a tag to compare

⚠️ Breaking changes

  • useWindowSize options have changed! We now have the ability to override breakpoints and other settings. Refer to the README:
Name Type Required Default value Description
useDebounce boolean optional true Defines if the callback is going to be executed when the user finishes resizing the screen or not
debounceTimeMs number optional 200 Debounce time to check when the user finishes resizing the screen
breakpoints ScreenBreakpoints optional Check types below Defines the breakpoints to be used, you can override and choose your own
  • The value returned by useWindowSize has changed: screenLayout now is an object that contains multiple properties:
{
  width?: number;
  height?: number;
  screenLayout?: {
    layout: xs | sm | md | lg | xl;
    isXsOrBelow: boolean;
    isSmOrBelow: boolean;
    isMdOrBelow: boolean;
    isLgOrBelow: boolean;
    isXlOrBelow: boolean;
  };
}

πŸ’… Improvements

  • πŸ’… The whole library was rewritten using TypeScript!

  • πŸ’… You can now set debounceTimeMs on the options (defaults to 200ms)

  • πŸ’… You can now override breakpoints used to determine the current layout!

1.0.61

08 Jun 14:57
Compare
Choose a tag to compare

Misc

  • πŸ†™ Updated dependencies