feat: implement upload dialog in admin dashboard with context management
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user