From 84d10ac9835469ddf0ea6eb91db00b267c59874f Mon Sep 17 00:00:00 2001 From: Ardeman Date: Fri, 14 Mar 2025 23:57:09 +0800 Subject: [PATCH] feat: remove ChevronIcon in navbar; add icon prop to Button component --- app/components/icons/chevron.tsx | 25 ------------------------- app/components/ui/button.tsx | 4 +++- app/layouts/admin/navbar.tsx | 6 +++--- 3 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 app/components/icons/chevron.tsx diff --git a/app/components/icons/chevron.tsx b/app/components/icons/chevron.tsx deleted file mode 100644 index 4161d77..0000000 --- a/app/components/icons/chevron.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import type { JSX, SVGProps } from 'react' -/** - * Note: `ChevronIcon` default mengarah ke bawah. - * Gunakan class `rotate-xx` untuk mengubah arah ikon. - */ -export const ChevronIcon = ( - properties: JSX.IntrinsicAttributes & SVGProps, -) => { - return ( - - - - ) -} diff --git a/app/components/ui/button.tsx b/app/components/ui/button.tsx index bfa8400..18e367f 100644 --- a/app/components/ui/button.tsx +++ b/app/components/ui/button.tsx @@ -44,6 +44,7 @@ type ButtonBaseProperties = { size?: VariantProps['size'] className?: string isLoading?: boolean + icon?: ReactNode } type PolymorphicReference = @@ -64,6 +65,7 @@ export const Button = ( size, className, isLoading = false, + icon, ...restProperties } = properties const Component = as || HeadlessButton @@ -74,7 +76,7 @@ export const Button = ( className={classes} {...restProperties} > - {isLoading && } + {isLoading ? : icon} {children} ) diff --git a/app/layouts/admin/navbar.tsx b/app/layouts/admin/navbar.tsx index adb426e..c5b09b7 100644 --- a/app/layouts/admin/navbar.tsx +++ b/app/layouts/admin/navbar.tsx @@ -3,9 +3,9 @@ import { ArrowRightStartOnRectangleIcon, UserIcon, } from '@heroicons/react/24/outline' +import { ChevronDownIcon } from '@heroicons/react/24/solid' import { Link, useFetcher, useRouteLoaderData } from 'react-router' -import { ChevronIcon } from '~/components/icons/chevron' import { ProfileIcon } from '~/components/icons/profile' import { Button } from '~/components/ui/button' import { APP } from '~/configs/meta' @@ -46,7 +46,7 @@ export const Navbar = () => { {staffData?.name} - + { type="submit" className="w-full justify-start rounded p-1 px-3 text-lg font-semibold" variant="secondary" + icon={} > - Logout