@gsretail.com/gui-core
Version:
A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook
2 lines (1 loc) • 705 B
JavaScript
import*as n from"react";import{arrayIncludes as e}from"../utils/utils.js";import t from"../../../utils/esm/useEnhancedEffect.js";function o(){return"undefined"==typeof window?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?90===Math.abs(window.screen.orientation.angle)?"landscape":"portrait":window.orientation&&90===Math.abs(Number(window.orientation))?"landscape":"portrait"}const i=(i,r)=>{const[a,s]=n.useState(o);if(t((()=>{const n=()=>{s(o())};return window.addEventListener("orientationchange",n),()=>{window.removeEventListener("orientationchange",n)}}),[]),e(i,["hours","minutes","seconds"]))return!1;return"landscape"===(r||a)};export{i as useIsLandscape};