diff --git a/webviews/editorWebview/overview.tsx b/webviews/editorWebview/overview.tsx index 15668e44d6..430477fa41 100644 --- a/webviews/editorWebview/overview.tsx +++ b/webviews/editorWebview/overview.tsx @@ -12,21 +12,53 @@ import { StatusChecksSection } from '../components/merge'; import Sidebar from '../components/sidebar'; import { Timeline } from '../components/timeline'; -export const Overview = (pr: PullRequest) => ( - <> +const useMediaQuery = (query: string) => { + const [matches, setMatches] = React.useState(window.matchMedia(query).matches); + + React.useEffect(() => { + const mediaQueryList = window.matchMedia(query); + const documentChangeHandler = () => setMatches(mediaQueryList.matches); + + mediaQueryList.addEventListener('change', documentChangeHandler); + + return () => { + mediaQueryList.removeEventListener('change', documentChangeHandler); + }; + }, [query]); + + return matches; +}; + +export const Overview = (pr: PullRequest) => { + const isSingleColumnLayout = useMediaQuery('(max-width: 925px)'); + + return <>