enhancement(web): filters list mobile friendly (#648)

* Made Filters page dynamic for mobile screens

* Small corrections

Filter names
- Break very long words (Just to safe guard)
- Whitespace wrap
- w-4/5 on filter names to avoid clipping
This commit is contained in:
soup 2023-01-17 23:37:10 +01:00 committed by GitHub
parent a6c1944df8
commit 14b7bc2fe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 33 deletions

View file

@ -24,7 +24,7 @@ export default function Base() {
{ name: "Filters", path: "/filters" },
{ name: "Releases", path: "/releases" },
{ name: "Settings", path: "/settings" },
{ name: "Logs", path: "/logs" }
{ name: "Logs", path: "/logs" },
];
return (
@ -55,20 +55,24 @@ export default function Base() {
</div>
<div className="sm:ml-3 hidden sm:block">
<div className="flex items-baseline space-x-4">
{nav.map((item, itemIdx) =>
{nav.map((item, itemIdx) => (
<NavLink
key={item.name + itemIdx}
to={item.path}
className={({ isActive }) => classNames(
"hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white px-3 py-2 rounded-2xl text-sm font-medium",
"transition-colors duration-200",
isActive ? "text-black dark:text-gray-50 font-bold" : "text-gray-600 dark:text-gray-500"
)}
className={({ isActive }) =>
classNames(
"hover:bg-gray-200 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white px-3 py-2 rounded-2xl text-sm font-medium",
"transition-colors duration-200",
isActive
? "text-black dark:text-gray-50 font-bold"
: "text-gray-600 dark:text-gray-500"
)
}
end={item.path === "/"}
>
{item.name}
</NavLink>
)}
))}
<a
rel="noopener noreferrer"
target="_blank"
@ -79,7 +83,10 @@ export default function Base() {
)}
>
Docs
<BookOpenIcon className="inline ml-1 h-5 w-5" aria-hidden="true" />
<BookOpenIcon
className="inline ml-1 h-5 w-5"
aria-hidden="true"
/>
</a>
</div>
</div>
@ -98,7 +105,9 @@ export default function Base() {
)}
>
<span className="hidden text-sm font-medium sm:block">
<span className="sr-only">Open user menu for </span>
<span className="sr-only">
Open user menu for{" "}
</span>
{authContext.username}
</span>
<UserIcon
@ -125,7 +134,9 @@ export default function Base() {
<Link
to="/settings"
className={classNames(
active ? "bg-gray-100 dark:bg-gray-600" : "",
active
? "bg-gray-100 dark:bg-gray-600"
: "",
"block px-4 py-2 text-sm text-gray-900 dark:text-gray-200"
)}
>
@ -138,7 +149,9 @@ export default function Base() {
<Link
to="/logout"
className={classNames(
active ? "bg-gray-100 dark:bg-gray-600" : "",
active
? "bg-gray-100 dark:bg-gray-600"
: "",
"block px-4 py-2 text-sm text-gray-900 dark:text-gray-200"
)}
>
@ -155,13 +168,18 @@ export default function Base() {
</div>
<div className="-mr-2 flex sm:hidden">
{/* Mobile menu button */}
<Disclosure.Button
className="bg-gray-200 dark:bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-600 dark:text-gray-400 hover:text-white hover:bg-gray-700">
<Disclosure.Button className="bg-gray-200 dark:bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-600 dark:text-gray-400 hover:text-white hover:bg-gray-700">
<span className="sr-only">Open main menu</span>
{open ? (
<XMarkIcon className="block h-6 w-6" aria-hidden="true"/>
<XMarkIcon
className="block h-6 w-6"
aria-hidden="true"
/>
) : (
<Bars3Icon className="block h-6 w-6" aria-hidden="true"/>
<Bars3Icon
className="block h-6 w-6"
aria-hidden="true"
/>
)}
</Disclosure.Button>
</div>
@ -171,19 +189,23 @@ export default function Base() {
<Disclosure.Panel className="border-b border-gray-300 dark:border-gray-700 md:hidden">
<div className="px-2 py-3 space-y-1 sm:px-3">
{nav.map((item) =>
{nav.map((item) => (
<NavLink
key={item.path}
to={item.path}
className={({ isActive }) => classNames(
"shadow-sm border bg-gray-100 border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-white block px-3 py-2 rounded-md text-base",
isActive ? "underline underline-offset-2 decoration-2 decoration-sky-500 font-bold text-black" : "font-medium"
)}
className={({ isActive }) =>
classNames(
"shadow-sm border bg-gray-100 border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-white block px-3 py-2 rounded-md text-base",
isActive
? "underline underline-offset-2 decoration-2 decoration-sky-500 font-bold text-black"
: "font-medium"
)
}
end={item.path === "/"}
>
{item.name}
</NavLink>
)}
))}
<Link
to="/logout"
className="shadow-sm border bg-gray-100 border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-white block px-3 py-2 rounded-md text-base font-medium"
@ -191,7 +213,6 @@ export default function Base() {
Logout
</Link>
</div>
</Disclosure.Panel>
</>
)}