From aa6494d77b6d43aae587e449f8edc3edafbc15da Mon Sep 17 00:00:00 2001 From: prostarz Date: Fri, 3 Jan 2025 16:04:17 +0000 Subject: [PATCH] feat(ui): adjust more of the ui/ux --- src/components/inputWithIcon.tsx | 42 +++++++++++++++++++ src/components/ui/button.tsx | 2 +- src/components/ui/skeleton.tsx | 8 ++-- src/features/search/components/search.tsx | 7 ++-- .../settings/components/tabs/container.tsx | 4 +- .../components/tabs/plugins/index.tsx | 20 +++++---- src/i18n/translations/english.json | 3 +- 7 files changed, 69 insertions(+), 17 deletions(-) create mode 100644 src/components/inputWithIcon.tsx diff --git a/src/components/inputWithIcon.tsx b/src/components/inputWithIcon.tsx new file mode 100644 index 0000000..fa5609b --- /dev/null +++ b/src/components/inputWithIcon.tsx @@ -0,0 +1,42 @@ +import { cn } from "@/lib"; +import React, { forwardRef, InputHTMLAttributes } from "react"; +import { Input } from "./ui/input"; + +interface Props extends InputHTMLAttributes { + startIcon?: React.ReactElement; + endIcon?: React.ReactElement; + divClassName?: string; +} + +export const InputWithIcon = forwardRef( + ({ className, type, startIcon, endIcon, divClassName, ...props }, ref) => { + const StartIcon = startIcon; + const EndIcon = endIcon; + + return ( +
+ {StartIcon && ( +
+ {startIcon} +
+ )} + + + + {EndIcon && ( +
+ {endIcon} +
+ )} +
+ ); + } +); diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 74bc078..f07cd87 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -11,7 +11,7 @@ const buttonVariants = cva( variant: { default: "bg-muted text-secondary-foreground hover:bg-muted/50", active: - "bg-primary/40 text-secondary-foreground hover:bg-primary/60 border-2 border-primary", + "bg-primary/80 text-secondary-foreground hover:bg-primary/90 border-2 border-primary", destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", success: "bg-green-700 text-secondary-foreground hover:bg-green-700/90", diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx index d7e45f7..73ba598 100644 --- a/src/components/ui/skeleton.tsx +++ b/src/components/ui/skeleton.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; function Skeleton({ className, @@ -6,10 +6,10 @@ function Skeleton({ }: React.HTMLAttributes) { return (
- ) + ); } -export { Skeleton } +export { Skeleton }; diff --git a/src/features/search/components/search.tsx b/src/features/search/components/search.tsx index 676b313..631ac65 100644 --- a/src/features/search/components/search.tsx +++ b/src/features/search/components/search.tsx @@ -1,8 +1,8 @@ -import { Input } from "@/components/ui/input"; import { PopoverContent } from "@/components/ui/popover"; import { useLanguageContext } from "@/contexts/I18N"; -import { ShipWheel } from "lucide-react"; +import { InputWithIcon } from "@/components/inputWithIcon"; +import { SearchIcon, ShipWheel } from "lucide-react"; import { useState } from "react"; import useSearch from "../hooks/useSearch"; import SearchCard from "./card"; @@ -20,11 +20,12 @@ const Search = ({
- setSearchTerm(e.target.value)} value={searchTerm} + startIcon={} />
diff --git a/src/features/settings/components/tabs/container.tsx b/src/features/settings/components/tabs/container.tsx index c37dc4c..e7ec9e2 100644 --- a/src/features/settings/components/tabs/container.tsx +++ b/src/features/settings/components/tabs/container.tsx @@ -1,7 +1,9 @@ import { PropsWithChildren } from "react"; const SettingsContainer = ({ children }: PropsWithChildren) => { - return
{children}
; + return ( +
{children}
+ ); }; export default SettingsContainer; diff --git a/src/features/settings/components/tabs/plugins/index.tsx b/src/features/settings/components/tabs/plugins/index.tsx index 0ce2796..ab1d450 100644 --- a/src/features/settings/components/tabs/plugins/index.tsx +++ b/src/features/settings/components/tabs/plugins/index.tsx @@ -1,13 +1,13 @@ +import { InputWithIcon } from "@/components/inputWithIcon"; import { Button } from "@/components/ui/button"; import { Dialog, DialogTrigger } from "@/components/ui/dialog"; -import { Input } from "@/components/ui/input"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { useLanguageContext } from "@/contexts/I18N"; -import { Plus } from "lucide-react"; +import { Filter, Plus, SearchIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { SettingsSection } from "../../section"; import SettingTitle from "../../title"; @@ -34,7 +34,7 @@ const PluginSettings = () => { }, []); return ( -
+
{t("settings.titles.plugins")} @@ -43,12 +43,13 @@ const PluginSettings = () => {
{/* Search Input */} - setSearch(e.target.value)} + startIcon={} /> {/* Add Plugin Button */} @@ -56,11 +57,12 @@ const PluginSettings = () => { - - {t("add_local_plugin")} + {t("install_plugin")} @@ -90,6 +92,10 @@ const PluginSettings = () => { /> + +
+ +
); }; diff --git a/src/i18n/translations/english.json b/src/i18n/translations/english.json index b95e25e..21b6a7d 100644 --- a/src/i18n/translations/english.json +++ b/src/i18n/translations/english.json @@ -130,5 +130,6 @@ "steam_id": "Steam ID", "wine_prefix_folder": "Wine Prefix Folder", "the_path_to_your_wine_prefix_folder": "The path to your wine prefix folder", - "import_from_igdb": "Import From IGDB" + "import_from_igdb": "Import From IGDB", + "install_plugin": "Install Plugin" }