From 279d4ff7a31ec2f483498bd6e1a6b16c48f4f627 Mon Sep 17 00:00:00 2001 From: stacksmash76 <98354295+stacksmash76@users.noreply.github.com> Date: Thu, 17 Feb 2022 20:59:06 +0100 Subject: [PATCH] feat: add filter dropdown #26 (#142) feat(FilterItemDropdown): added a filter dropdown component from #26 * fix(react-multi-select-component): adjusted the component to fit in with other components when comparing across multiple browsers. (where firefox consistently handles pixels and rem's, chromium doesn't agree). refactor(input): removed shadow from input components to match react-multi-select-component look where needed. refactor(SwitchGroup): added a small top margin for a less dense look. cleaned up surrounding code. refactor(DeleteModal): adjusted the background color to fit more nicely across dark/light themes. made the exclamation icon bigger and removed the circle container. refactor(Logs): adjusted text color on the light theme. cleaned up the code. refactor(FilterAddForm): adapted to conform with the changes. feat(FilterItemDropdown): added a dropdown component to the filter list as proposed in #26. could use a better look, though. also, cleaned up surrounding code and got rid of pesky negative margins. refactor(FilterListItem): made the table striped when using the dark theme. adapter for the dropdown component. refactor(filters/details): - removed needless border properties from remove button, which left artifacts after de-focusing the button. also, removed the shadow from the cancel button. - added invalidation of the filter list on a delete mutation before redirecting to /filters. - modified certain group descriptions a bit in order to make them a bit more concise. - overall, cleaned up the surrounding code further. --- web/src/components/inputs/input.tsx | 6 +- web/src/components/inputs/switch.tsx | 110 ++++----- web/src/components/modals/index.tsx | 10 +- web/src/forms/filters/FilterAddForm.tsx | 15 +- web/src/index.css | 70 ++++-- web/src/screens/Base.tsx | 2 +- web/src/screens/Logs.tsx | 11 +- web/src/screens/filters/details.tsx | 50 ++-- web/src/screens/filters/list.tsx | 288 ++++++++++++++++++------ 9 files changed, 356 insertions(+), 206 deletions(-) diff --git a/web/src/components/inputs/input.tsx b/web/src/components/inputs/input.tsx index a68d8cc..62c28cc 100644 --- a/web/src/components/inputs/input.tsx +++ b/web/src/components/inputs/input.tsx @@ -41,7 +41,7 @@ export const TextField = ({ id={name} type="text" autoComplete={autoComplete} - className="mt-2 block w-full dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:text-gray-100 sm:text-sm" + className="mt-2 block w-full dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-md py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:text-gray-100" placeholder={placeholder} /> @@ -99,7 +99,7 @@ export const PasswordField = ({ id={name} type={isVisible ? "text" : "password"} autoComplete={autoComplete} - className={classNames(meta.touched && meta.error ? "focus:ring-red-500 focus:border-red-500 border-red-500" : "focus:ring-indigo-500 dark:focus:ring-blue-500 focus:border-indigo-500 dark:focus:border-blue-500 border-gray-300 dark:border-gray-700", "mt-2 block w-full dark:bg-gray-800 shadow-sm dark:text-gray-100 sm:text-sm rounded-md")} + className={classNames(meta.touched && meta.error ? "focus:ring-red-500 focus:border-red-500 border-red-500" : "focus:ring-indigo-500 dark:focus:ring-blue-500 focus:border-indigo-500 dark:focus:border-blue-500 border-gray-300 dark:border-gray-700", "mt-2 block w-full dark:bg-gray-800 dark:text-gray-100 rounded-md")} placeholder={placeholder} /> @@ -150,7 +150,7 @@ export const NumberField = ({ meta.touched && meta.error ? "focus:ring-red-500 focus:border-red-500 border-red-500" : "focus:ring-indigo-500 dark:focus:ring-blue-500 focus:border-indigo-500 dark:focus:border-blue-500 border-gray-300", - "mt-2 block w-full dark:bg-gray-800 border border-gray-300 dark:border-gray-700 shadow-sm dark:text-gray-100 sm:text-sm rounded-md" + "mt-2 block w-full dark:bg-gray-800 border border-gray-300 dark:border-gray-700 dark:text-gray-100 rounded-md" )} placeholder={placeholder} /> diff --git a/web/src/components/inputs/switch.tsx b/web/src/components/inputs/switch.tsx index a25973b..0683a69 100644 --- a/web/src/components/inputs/switch.tsx +++ b/web/src/components/inputs/switch.tsx @@ -77,78 +77,50 @@ const SwitchGroup = ({ label, description }: SwitchGroupProps) => ( -