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) {
min-height: calc(100vh - 400px); .container {
min-height: calc(100vh - 400px);
}
} }
@media only screen and (max-width: 48em) {
.container {
min-height: 400px;
}
} */

View file

@ -71,42 +71,46 @@ export default function RootLayout({
</div> </div>
</div> </div>
</div> </div>
<Container>{children}</Container> <div className='flex min-h-[72vh] flex-col'>
<footer> <div className='flex-grow'>
<div className={styles.footerContent}> <Container>{children}</Container>
<ul>
<li key='about'>
<Link href='/about'>About</Link>
</li>
<li key='help'>
<Link href='/help'>Help</Link>
</li>
<li key='contact'>
<Link href='/contact'>Contact</Link>
</li>
<li key='subscribe'>
<Link href='/subscribe'>Subscribe</Link>
</li>
<li key='copyright'>
<Link href='/legal/copyright'>Copyright</Link>
</li>
<li key='privacy'>
<Link href='/legal/privacy'>Privacy Policy</Link>
</li>
<li key='accessibility'>
<Link href='/help/accessibility'>Accessibility</Link>
</li>
<li key='status'>
<Link href='/status'>eeXiv status</Link>
</li>
<li key='notifications'>
<Link href='/status/notifications'>
Get status notifications
</Link>
</li>
</ul>
</div> </div>
</footer> <footer className='bottom-0'>
<div className={styles.footerContent}>
<ul>
<li key='about'>
<Link href='/about'>About</Link>
</li>
<li key='help'>
<Link href='/help'>Help</Link>
</li>
<li key='contact'>
<Link href='/contact'>Contact</Link>
</li>
<li key='subscribe'>
<Link href='/subscribe'>Subscribe</Link>
</li>
<li key='copyright'>
<Link href='/legal/copyright'>Copyright</Link>
</li>
<li key='privacy'>
<Link href='/legal/privacy'>Privacy Policy</Link>
</li>
<li key='accessibility'>
<Link href='/help/accessibility'>Accessibility</Link>
</li>
<li key='status'>
<Link href='/status'>eeXiv status</Link>
</li>
<li key='notifications'>
<Link href='/status/notifications'>
Get status notifications
</Link>
</li>
</ul>
</div>
</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'] })