Condense feeds on mobile See merge request soapbox-pub/soapbox!3047environments/review-main-yi2y9f/deployments/4663
commit
1e9a86ee26
@ -0,0 +1,6 @@
|
||||
import { useScreenWidth } from './useScreenWidth';
|
||||
|
||||
export function useIsMobile() {
|
||||
const screenWidth = useScreenWidth();
|
||||
return screenWidth <= 581;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
export function useScreenWidth() {
|
||||
const [screenWidth, setScreenWidth] = useState(window.innerWidth);
|
||||
|
||||
useEffect(() => {
|
||||
const checkWindowSize = () => {
|
||||
setScreenWidth(window.innerWidth);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', checkWindowSize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', checkWindowSize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return screenWidth;
|
||||
}
|
Loading…
Reference in new issue