From 14b7bc2fe25c602da2accae9196df6a7b1289004 Mon Sep 17 00:00:00 2001 From: soup Date: Tue, 17 Jan 2023 23:37:10 +0100 Subject: [PATCH] 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 --- web/src/screens/Base.tsx | 67 +++++++++++++++++++++----------- web/src/screens/filters/list.tsx | 20 +++++----- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/web/src/screens/Base.tsx b/web/src/screens/Base.tsx index aed3b78..6f0d831 100644 --- a/web/src/screens/Base.tsx +++ b/web/src/screens/Base.tsx @@ -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() {
- {nav.map((item, itemIdx) => + {nav.map((item, itemIdx) => ( 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} - )} + ))} Docs -
@@ -98,7 +105,9 @@ export default function Base() { )} > - Open user menu for + + Open user menu for{" "} + {authContext.username} @@ -138,7 +149,9 @@ export default function Base() { @@ -155,13 +168,18 @@ export default function Base() {
{/* Mobile menu button */} - + Open main menu {open ? ( -
@@ -171,19 +189,23 @@ export default function Base() {
- {nav.map((item) => + {nav.map((item) => ( 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} - )} + ))}
-
)} diff --git a/web/src/screens/filters/list.tsx b/web/src/screens/filters/list.tsx index c2013c2..053a4fd 100644 --- a/web/src/screens/filters/list.tsx +++ b/web/src/screens/filters/list.tsx @@ -149,7 +149,7 @@ function FilterList({ toggleCreateFilter }: any) {
- +
@@ -390,7 +390,7 @@ function FilterListItem({ filter, idx }: FilterListItemProps) {
  • -
    - +
    +
    - + Priority: {filter.priority} @@ -440,10 +440,10 @@ function FilterListItem({ filter, idx }: FilterListItemProps) {
    - + - + = ({ indexer }) => ( {indexer.name} @@ -478,7 +478,7 @@ function FilterIndexers({ indexers }: FilterIndexersProps) { ? indexers.map((indexer, idx) => ( )) - : NO INDEXERS SELECTED + : NO INDEXERS SELECTED } ); @@ -521,7 +521,7 @@ const ListboxFilter = ({ onChange={onChange} >
    - + {label}