-
Notifications
You must be signed in to change notification settings - Fork 23
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 #1321 from kianamcc/PORTALS-3266
PORTALS-3266: staging only: "submit a tool" button points to old google forms
- Loading branch information
Showing
6 changed files
with
179 additions
and
12 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
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
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
68 changes: 68 additions & 0 deletions
68
packages/synapse-react-client/src/components/DynamicForm/DynamicFormModal.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,68 @@ | ||
import React, { useState } from 'react' | ||
import ConfirmationDialog from '../ConfirmationDialog' | ||
import { SynapseComponents } from '../..' | ||
import { Box } from '@mui/material' | ||
import DynamicForm, { DynamicFormProps } from '.' | ||
|
||
type ModalProps = { | ||
submitButtonText?: string | ||
} | ||
|
||
export type DynamicFormModalProps = DynamicFormProps & ModalProps | ||
|
||
const DynamicFormModal = ({ | ||
schemaUrl, | ||
uiSchemaUrl, | ||
postUrl, | ||
submitButtonText, | ||
}: DynamicFormModalProps) => { | ||
const [open, setOpen] = useState(false) | ||
|
||
const handleClickOpen = () => { | ||
setOpen(true) | ||
} | ||
|
||
const handleClose = () => { | ||
setOpen(false) | ||
} | ||
|
||
const form = ( | ||
<DynamicForm | ||
schemaUrl={schemaUrl} | ||
uiSchemaUrl={uiSchemaUrl} | ||
postUrl={postUrl} | ||
onSubmit={() => { | ||
handleClose() | ||
}} | ||
/> | ||
) | ||
|
||
return ( | ||
<div className="browse-tools-page"> | ||
<Box sx={{ margin: '10px 0px 50px 0px' }}> | ||
<SynapseComponents.WideButton | ||
className="highlightSubmitToolButton" | ||
variant="contained" | ||
onClick={handleClickOpen} | ||
> | ||
{submitButtonText} | ||
</SynapseComponents.WideButton> | ||
<ConfirmationDialog | ||
open={open} | ||
title="" | ||
content={form} | ||
onCancel={handleClose} | ||
onConfirm={() => {}} | ||
confirmButtonProps={{ | ||
sx: { display: 'none' }, | ||
}} | ||
cancelButtonProps={{ | ||
children: 'cancel', | ||
}} | ||
/> | ||
</Box> | ||
</div> | ||
) | ||
} | ||
|
||
export default DynamicFormModal |
9 changes: 8 additions & 1 deletion
9
packages/synapse-react-client/src/components/DynamicForm/index.ts
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,4 +1,11 @@ | ||
import DynamicForm from './DynamicForm' | ||
import DynamicFormModal from './DynamicFormModal' | ||
import type { DynamicFormProps } from './DynamicForm' | ||
export { DynamicForm, DynamicFormProps } | ||
import type { DynamicFormModalProps } from './DynamicFormModal' | ||
export { | ||
DynamicForm, | ||
DynamicFormModal, | ||
DynamicFormProps, | ||
DynamicFormModalProps, | ||
} | ||
export default DynamicForm |