-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #489 from masslight/aykhan/fix-pdf-support
Enable pdf file type for file uploads
- Loading branch information
Showing
16 changed files
with
292 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/ottehr-components/lib/components/form/NonImageCardComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; | ||
import { Box, IconButton, Link } from '@mui/material'; | ||
import { FC, useContext } from 'react'; | ||
import { useFormContext } from 'react-hook-form'; | ||
import { IntakeThemeContext } from '../../contexts'; | ||
|
||
interface NonImageCardComponentProps { | ||
name: string; | ||
fileName?: string; | ||
fileUrl?: string; | ||
setPreviewUrl: (previewUrl: string | null) => void; | ||
setFileUrl: (fileUrl: string | undefined) => void; | ||
onClear: () => void; | ||
} | ||
|
||
const NonImageCardComponent: FC<NonImageCardComponentProps> = ({ | ||
name, | ||
fileName, | ||
fileUrl, | ||
setPreviewUrl, | ||
setFileUrl, | ||
onClear, | ||
}): JSX.Element => { | ||
const { setValue } = useFormContext(); | ||
const { otherColors } = useContext(IntakeThemeContext); | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
px: 2, | ||
py: 0.25, | ||
backgroundColor: otherColors.toolTipGrey, | ||
borderRadius: 2, | ||
alignItems: 'center', | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<Link href={fileUrl} target="_blank"> | ||
{fileName} | ||
</Link> | ||
<IconButton | ||
aria-label="remove-attachment" | ||
onClick={() => { | ||
setValue(name, ''); | ||
setPreviewUrl(null); | ||
setFileUrl(undefined); | ||
onClear(); | ||
}} | ||
sx={{ | ||
color: otherColors.clearImage, | ||
px: 0, | ||
'&:hover': { backgroundColor: 'transparent' }, | ||
}} | ||
> | ||
<DeleteForeverIcon /> | ||
</IconButton> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default NonImageCardComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
export { default as CardComponent } from './CardComponent'; | ||
export { default as ControlButtons } from './ControlButtons'; | ||
export { default as ControlledCheckBox } from './ControlledCheckBox'; | ||
export { default as DateInput } from './DateInput'; | ||
export { default as FileUpload } from './FileUpload'; | ||
export { default as FormInput } from './FormInput'; | ||
export { default as FreeMultiSelectInput } from './FreeMultiSelectInput'; | ||
export { default as NonImageCardComponent } from './NonImageCardComponent'; | ||
export { default as InputMask } from './InputMask'; | ||
export { default as ControlButtons } from './ControlButtons'; | ||
export { default as SelectInput } from './SelectInput'; | ||
export { default as RenderLabelFromSelect } from './RenderLabelFromSelect'; | ||
export { default as RadioInput } from './RadioInput'; | ||
export { default as FreeMultiSelectInput } from './FreeMultiSelectInput'; | ||
export { default as DateInput } from './DateInput'; | ||
export { default as RadioListInput } from './RadioListInput'; | ||
export { default as ControlledCheckBox } from './ControlledCheckBox'; | ||
export { default as FileUpload } from './FileUpload'; | ||
export { default as RenderLabelFromSelect } from './RenderLabelFromSelect'; | ||
export { default as SelectInput } from './SelectInput'; | ||
export { default as UploadComponent } from './UploadComponent'; | ||
export { default as CardComponent } from './CardComponent'; | ||
export { default as YearInput } from './YearInput'; | ||
export * from './BoldPurpleInputLabel'; | ||
export * from './InputHelperText'; | ||
export * from './LinkRenderer'; | ||
export * from './DescriptionRenderer'; | ||
export * from './LightToolTip'; | ||
export * from './FormList'; | ||
export * from './InputHelperText'; | ||
export * from './LightToolTip'; | ||
export * from './LinkRenderer'; | ||
export * from './VisuallyHiddenInput'; | ||
export * from './VirtualizedListboxComponent'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.