@anton.bobrov/react-vevet-hooks
Version:
A collection of custom React hooks designed to seamlessly integrate with the `Vevet` library
24 lines (23 loc) • 688 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIsViewportPhone = void 0;
var useBreakpointName_1 = require("./useBreakpointName");
/**
* Custom React hook that checks if the current viewport breakpoint is 'phone'.
*
* @example
* const MyComponent = () => {
* const isPhone = useIsViewportPhone();
*
* return (
* <div>
* {isPhone ? 'Viewport is of phone size.' : 'Not phone.'}
* </div>
* );
* };
*/
function useIsViewportPhone() {
var breakpointName = (0, useBreakpointName_1.useBreakpointName)();
return breakpointName === 'phone';
}
exports.useIsViewportPhone = useIsViewportPhone;