Would be good to rewrite this as a matchMedia after this PR is merged.