feat: implement upload dialog in admin dashboard with context management

This commit is contained in:
Ardeman
2025-03-09 20:52:50 +08:00
parent f291290f55
commit 4bb7a23795
2 changed files with 30 additions and 2 deletions
+6 -1
View File
@@ -11,6 +11,8 @@ import {
import { useRemixFormContext } from 'remix-hook-form'
import { twMerge } from 'tailwind-merge'
import { useAdminContext } from '~/contexts/admin'
import { Button } from './button'
type TInputProperties<T extends FieldValues> = Omit<
@@ -40,6 +42,7 @@ export const InputFile = <TFormValues extends Record<string, unknown>>(
labelClassName,
...restProperties
} = properties
const { setIsUploadOpen } = useAdminContext()
const {
register,
@@ -71,7 +74,9 @@ export const InputFile = <TFormValues extends Record<string, unknown>>(
variant="icon"
size="fit"
className="absolute right-3 h-[42px]"
onClick={() => {}}
onClick={() => {
setIsUploadOpen('featured_image')
}}
>
<CloudArrowUpIcon className="h-4 w-4 text-gray-500/50" />
</Button>