fix(frontend): fix sliders overflowing on firefox

fixes #566
This commit is contained in:
sct
2021-01-03 13:50:28 +00:00
parent ce0687922a
commit 67ac9e075f
2 changed files with 17 additions and 20 deletions

View File

@@ -18,18 +18,18 @@ const Layout: React.FC = ({ children }) => {
const router = useRouter(); const router = useRouter();
return ( return (
<div className="min-h-full h-full flex bg-gray-900"> <div className="flex h-full min-w-0 min-h-full bg-gray-900">
<Sidebar open={isSidebarOpen} setClosed={() => setSidebarOpen(false)} /> <Sidebar open={isSidebarOpen} setClosed={() => setSidebarOpen(false)} />
<div className="flex flex-col w-0 flex-1 md:ml-64 relative mb-16"> <div className="relative flex flex-col flex-1 w-0 min-w-0 mb-16 md:ml-64">
<div className="z-10 flex-shrink-0 flex h-16 bg-gray-600 shadow fixed right-0 left-0 md:left-64"> <div className="fixed left-0 right-0 z-10 flex flex-shrink-0 h-16 bg-gray-600 shadow md:left-64">
<button <button
className="px-4 border-r border-gray-800 text-gray-200 focus:outline-none focus:bg-gray-300 focus:text-gray-600 md:hidden" className="px-4 text-gray-200 border-r border-gray-800 focus:outline-none focus:bg-gray-300 focus:text-gray-600 md:hidden"
aria-label="Open sidebar" aria-label="Open sidebar"
onClick={() => setSidebarOpen(true)} onClick={() => setSidebarOpen(true)}
> >
<svg <svg
className="h-6 w-6" className="w-6 h-6"
stroke="currentColor" stroke="currentColor"
fill="none" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -42,7 +42,7 @@ const Layout: React.FC = ({ children }) => {
/> />
</svg> </svg>
</button> </button>
<div className="flex-1 px-4 flex justify-between"> <div className="flex justify-between flex-1 px-4">
<SearchInput /> <SearchInput />
<div className="flex items-center md:ml-6"> <div className="flex items-center md:ml-6">
<LanguagePicker /> <LanguagePicker />
@@ -51,18 +51,15 @@ const Layout: React.FC = ({ children }) => {
</div> </div>
</div> </div>
<main <main className="relative z-0 top-16 focus:outline-none" tabIndex={0}>
className="relative z-0 top-16 focus:outline-none right-0"
tabIndex={0}
>
<div className="pt-2 pb-6"> <div className="pt-2 pb-6">
<div className="max-w-8xl mx-auto px-4"> <div className="px-4 mx-auto max-w-8xl">
{router.pathname === '/' && hasPermission(Permission.ADMIN) && ( {router.pathname === '/' && hasPermission(Permission.ADMIN) && (
<div className="rounded-md bg-indigo-700 p-4 mt-2"> <div className="p-4 mt-2 bg-indigo-700 rounded-md">
<div className="flex"> <div className="flex">
<div className="flex-shrink-0"> <div className="flex-shrink-0">
<svg <svg
className="h-5 w-5 text-white" className="w-5 h-5 text-white"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" viewBox="0 0 20 20"
fill="currentColor" fill="currentColor"
@@ -74,14 +71,14 @@ const Layout: React.FC = ({ children }) => {
/> />
</svg> </svg>
</div> </div>
<div className="ml-3 flex-1 md:flex md:justify-between"> <div className="flex-1 ml-3 md:flex md:justify-between">
<p className="text-sm leading-5 text-white"> <p className="text-sm leading-5 text-white">
<FormattedMessage {...messages.alphawarning} /> <FormattedMessage {...messages.alphawarning} />
</p> </p>
<p className="mt-3 text-sm leading-5 md:mt-0 md:ml-6"> <p className="mt-3 text-sm leading-5 md:mt-0 md:ml-6">
<a <a
href="http://github.com/sct/overseerr" href="http://github.com/sct/overseerr"
className="whitespace-nowrap font-medium text-indigo-100 hover:text-white transition ease-in-out duration-150" className="font-medium text-indigo-100 transition duration-150 ease-in-out whitespace-nowrap hover:text-white"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >

View File

@@ -160,7 +160,7 @@ const Slider: React.FC<SliderProps> = ({
return ( return (
<div className="relative"> <div className="relative">
<div className="absolute flex text-gray-400 right-0 -mt-10"> <div className="absolute right-0 flex -mt-10 text-gray-400">
<button <button
className={`${ className={`${
scrollPos.isStart ? 'cursor-not-allowed text-gray-800' : '' scrollPos.isStart ? 'cursor-not-allowed text-gray-800' : ''
@@ -207,14 +207,14 @@ const Slider: React.FC<SliderProps> = ({
</button> </button>
</div> </div>
<div <div
className="relative overflow-x-scroll whitespace-nowrap hide-scrollbar overscroll-x-contain -ml-4 -mr-4 px-2 overflow-y-auto" className="relative px-2 -ml-4 -mr-4 overflow-x-scroll overflow-y-auto whitespace-nowrap hide-scrollbar overscroll-x-contain"
ref={containerRef} ref={containerRef}
onScroll={onScroll} onScroll={onScroll}
> >
{items?.map((item, index) => ( {items?.map((item, index) => (
<div <div
key={`${sliderKey}-${index}`} key={`${sliderKey}-${index}`}
className="px-2 inline-block align-top" className="inline-block px-2 align-top"
> >
{item} {item}
</div> </div>
@@ -223,13 +223,13 @@ const Slider: React.FC<SliderProps> = ({
[...Array(10)].map((_item, i) => ( [...Array(10)].map((_item, i) => (
<div <div
key={`placeholder-${i}`} key={`placeholder-${i}`}
className="px-2 inline-block align-top" className="inline-block px-2 align-top"
> >
{placeholder} {placeholder}
</div> </div>
))} ))}
{isEmpty && ( {isEmpty && (
<div className="text-center text-white mt-16 mb-16"> <div className="mt-16 mb-16 text-center text-white">
{emptyMessage ? ( {emptyMessage ? (
emptyMessage emptyMessage
) : ( ) : (