feat: add password change modal (#552)

* feat: add password change modal

Based on the error code sent from the platform, the modal will either
be to nudge users to change password or block users from logging in.

VAN-667
VAN-668
This commit is contained in:
Zainab Amir
2022-04-04 16:42:07 +05:00
committed by GitHub
parent 7f7931fec5
commit 2099e62bb4
8 changed files with 294 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
import { useState, useEffect } from 'react';
import { breakpoints } from '@edx/paragon';
/**
* A react hook used to determine if the current window is mobile or not.
* returns true if the window is of mobile size.
* Code source: https://github.com/edx/prospectus/blob/master/src/utils/useMobileResponsive.js
*/
const useMobileResponsive = (breakpoint) => {
const [isMobileWindow, setIsMobileWindow] = useState();
const checkForMobile = () => {
setIsMobileWindow(window.matchMedia(`(max-width: ${breakpoint || breakpoints.small.maxWidth}px)`).matches);
};
useEffect(() => {
checkForMobile();
window.addEventListener('resize', checkForMobile);
// return this function here to clean up the event listener
return () => window.removeEventListener('resize', checkForMobile);
}, []);
return isMobileWindow;
};
export default useMobileResponsive;