garbage mobile fix

This commit is contained in:
Youwen Wu 2024-02-12 23:02:25 -08:00
parent 275d98aa45
commit 8d642c4785
7 changed files with 68 additions and 45 deletions

View file

@ -32,6 +32,11 @@ export default function MobileMenu() {
} }
} }
const handleSubmit = () => {
setIsOpen(false)
document.body.style.overflow = 'auto'
}
return ( return (
<div className='w-20'> <div className='w-20'>
<button <button
@ -42,7 +47,7 @@ export default function MobileMenu() {
</button> </button>
<div className={`${isOpen ? '' : styles['menu-hidden']} ${styles.menu}`}> <div className={`${isOpen ? '' : styles['menu-hidden']} ${styles.menu}`}>
<span className={styles['search-bar']}> <span className={styles['search-bar']}>
<SearchBar /> <SearchBar onSubmit={handleSubmit} />
</span> </span>
<p className='text-slate-600 mx-4 my-4'> <p className='text-slate-600 mx-4 my-4'>
We gratefully acknowledge support from our volunteer peer reviewers, We gratefully acknowledge support from our volunteer peer reviewers,

View file

@ -14,7 +14,7 @@ export default function News() {
<ul className='text-slate-50 px-6 list-disc'> <ul className='text-slate-50 px-6 list-disc'>
<li key={1}> <li key={1}>
eeXiv 2.0 has been released! The site should feel significantly more eeXiv 2.0 has been released! The site should feel significantly more
responsive. Data cacheing has also been implemented so search results responsive. Data caching has also been implemented so search results
and documents will load instantly the second time. and documents will load instantly the second time.
</li> </li>
<li key={2}>Mobile support is currently in beta.</li> <li key={2}>Mobile support is currently in beta.</li>

View file

@ -2,12 +2,15 @@
import { useRouter } from 'next/navigation' import { useRouter } from 'next/navigation'
import { useState } from 'react' import { useState } from 'react'
export default function SearchBar() { export default function SearchBar({
onSubmit,
}: Readonly<{ onSubmit?: () => void }>) {
const [searchInput, setSearchInput] = useState('') const [searchInput, setSearchInput] = useState('')
const router = useRouter() const router = useRouter()
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
router.push(`/search?q=${encodeURIComponent(searchInput)}`) router.push(`/search?q=${encodeURIComponent(searchInput)}`)
onSubmit && onSubmit()
} }
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {

View file

@ -1,6 +1,10 @@
.menu { .menu {
@apply w-[100vw] h-full overflow-x-hidden left-[0] top-[235px] z-10 absolute bg-slate-200; @apply overflow-hidden left-[0] top-[235px] z-10 absolute bg-slate-200;
@apply transition-transform duration-300 ease-in-out; @apply duration-300;
height: calc(200px);
transition: width 0.5s ease-in-out;
width: 100vw;
right: 0;
} }
.search-bar { .search-bar {
@ -12,5 +16,5 @@
} }
.menu-hidden { .menu-hidden {
@apply translate-y-[100vh] invisible; width: 0;
} }

View file

@ -1,3 +1,11 @@
.container { /* @media only screen and (min-width: 48em) {
.container {
min-height: calc(100vh - 400px); min-height: calc(100vh - 400px);
}
} }
@media only screen and (max-width: 48em) {
.container {
min-height: 400px;
}
} */

View file

@ -71,8 +71,11 @@ export default function RootLayout({
</div> </div>
</div> </div>
</div> </div>
<div className='flex min-h-[72vh] flex-col'>
<div className='flex-grow'>
<Container>{children}</Container> <Container>{children}</Container>
<footer> </div>
<footer className='bottom-0'>
<div className={styles.footerContent}> <div className={styles.footerContent}>
<ul> <ul>
<li key='about'> <li key='about'>
@ -107,6 +110,7 @@ export default function RootLayout({
</ul> </ul>
</div> </div>
</footer> </footer>
</div>
</Providers> </Providers>
</body> </body>
</html> </html>

View file

@ -1,12 +1,11 @@
'use client' 'use client'
import { useSearchParams } from 'next/navigation' import { useSearchParams, useRouter } from 'next/navigation'
import { Zilla_Slab } from 'next/font/google' import { Zilla_Slab } from 'next/font/google'
import { Topics, Authors } from '@/app/components/DataDisplay' import { Topics, Authors } from '@/app/components/DataDisplay'
import { Status, ItemBadge } from '@/app/components/Badges' import { Status, ItemBadge } from '@/app/components/Badges'
import { epoch2datestring } from '../utils/epoch2datestring' import { epoch2datestring } from '../utils/epoch2datestring'
import searchDocs, { CustomSearchResult } from '@/app/utils/searchDocs' import searchDocs, { CustomSearchResult } from '@/app/utils/searchDocs'
import { useSuspenseQuery } from '@tanstack/react-query' import { useSuspenseQuery } from '@tanstack/react-query'
import { useRouter } from 'next/navigation'
const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500', '700'] }) const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500', '700'] })