fix: inputs limit to their respective file formats

This commit is contained in:
Chris Holland 2024-10-22 15:26:46 -07:00
parent 19cc3ea0d7
commit b678ac86e8
No known key found for this signature in database
GPG key ID: 68B0A864B1B0A0D2
9 changed files with 55 additions and 6 deletions

View file

@ -9,6 +9,9 @@ import FormLayout, {
import React, { useState } from 'react'
import * as Form from '@radix-ui/react-form'
import BarLoader from 'react-spinners/BarLoader'
import { constructAcceptValue } from '@/lib/constants';
const SUPPORTED_FILES = constructAcceptValue(['pdf'])
function DocumentPdfModal({ submitFileActivity, chapterId, course }: any) {
const [documentpdf, setDocumentPdf] = React.useState(null) as any
@ -64,7 +67,7 @@ function DocumentPdfModal({ submitFileActivity, chapterId, course }: any) {
</FormMessage>
</Flex>
<Form.Control asChild>
<input type="file" onChange={handleDocumentPdfChange} required />
<input accept={SUPPORTED_FILES} type="file" onChange={handleDocumentPdfChange} required />
</Form.Control>
</FormField>